mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add base::OnceClosure support in cef_closure_task.h (see issue #3140)
This commit is contained in:
@ -42,14 +42,16 @@
|
||||
#include "include/cef_task.h"
|
||||
|
||||
///
|
||||
// Helpers for asynchronously executing a base::Closure (bound function or
|
||||
// method) on a CEF thread. Creation of base::Closures can be facilitated using
|
||||
// base::Bind. See include/base/cef_callback.h for complete usage instructions.
|
||||
// Helpers for asynchronously executing a base::[Once|Repeating]Closure (bound
|
||||
// function or method) on a CEF thread. Creation of a
|
||||
// base::[Once|Repeating]Closure can be facilitated using
|
||||
// base::Bind[Once|Repeating]. See include/base/cef_callback.h for complete
|
||||
// usage instructions.
|
||||
//
|
||||
// TO use these helpers you should include this header and the header that
|
||||
// defines base::Bind.
|
||||
// To use these helpers you should include this header and the header that
|
||||
// defines base::Bind[Once|Repeating].
|
||||
//
|
||||
// #include "include/base/cef_bind.h"
|
||||
// #include "include/base/cef_callback.h"
|
||||
// #include "include/wrapper/cef_closure_task.h"
|
||||
//
|
||||
// Example of executing a bound function:
|
||||
@ -59,7 +61,7 @@
|
||||
//
|
||||
// // Post a task that will execute MyFunc on the UI thread and pass an |arg|
|
||||
// // value of 5.
|
||||
// CefPostTask(TID_UI, base::Bind(&MyFunc, 5));
|
||||
// CefPostTask(TID_UI, base::BindOnce(&MyFunc, 5));
|
||||
//
|
||||
// Example of executing a bound method:
|
||||
//
|
||||
@ -78,25 +80,31 @@
|
||||
// // Post a task that will execute MyClass::MyMethod on the UI thread and pass
|
||||
// // an |arg| value of 5. |instance| will be kept alive until after the task
|
||||
// // completes.
|
||||
// CefPostTask(TID_UI, base::Bind(&MyClass::MyMethod, instance, 5));
|
||||
// CefPostTask(TID_UI, base::BindOnce(&MyClass::MyMethod, instance, 5));
|
||||
///
|
||||
|
||||
///
|
||||
// Create a CefTask that wraps a base::Closure. Can be used in combination with
|
||||
// CefTaskRunner.
|
||||
// Create a CefTask that wraps a base::[Once|Repeating]Closure. Can be used in
|
||||
// combination with CefTaskRunner.
|
||||
///
|
||||
CefRefPtr<CefTask> CefCreateClosureTask(const base::Closure& closure);
|
||||
CefRefPtr<CefTask> CefCreateClosureTask(base::OnceClosure closure);
|
||||
CefRefPtr<CefTask> CefCreateClosureTask(const base::RepeatingClosure& closure);
|
||||
|
||||
///
|
||||
// Post a Closure for execution on the specified thread.
|
||||
// Post a base::[Once|Repeating]Closure for execution on the specified thread.
|
||||
///
|
||||
bool CefPostTask(CefThreadId threadId, const base::Closure& closure);
|
||||
bool CefPostTask(CefThreadId threadId, base::OnceClosure closure);
|
||||
bool CefPostTask(CefThreadId threadId, const base::RepeatingClosure& closure);
|
||||
|
||||
///
|
||||
// Post a Closure for delayed execution on the specified thread.
|
||||
// Post a base::[Once|Repeating]Closure for delayed execution on the specified
|
||||
// thread.
|
||||
///
|
||||
bool CefPostDelayedTask(CefThreadId threadId,
|
||||
const base::Closure& closure,
|
||||
base::OnceClosure closure,
|
||||
int64 delay_ms);
|
||||
bool CefPostDelayedTask(CefThreadId threadId,
|
||||
const base::RepeatingClosure& closure,
|
||||
int64 delay_ms);
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_CLOSURE_TASK_H_
|
||||
|
Reference in New Issue
Block a user