]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/wrapper/cef_closure_task.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / wrapper / cef_closure_task.h
1 // Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // The contents of this file are only available to applications that link
33 // against the libcef_dll_wrapper target.
34 //
35
36 #ifndef CEF_INCLUDE_WRAPPER_CEF_CLOSURE_TASK_H_
37 #define CEF_INCLUDE_WRAPPER_CEF_CLOSURE_TASK_H_
38 #pragma once
39
40 #include "include/base/cef_callback_forward.h"
41 #include "include/base/cef_macros.h"
42 #include "include/cef_task.h"
43
44 ///
45 // Helpers for asynchronously executing a base::Closure (bound function or
46 // method) on a CEF thread. Creation of base::Closures can be facilitated using
47 // base::Bind. See include/base/cef_callback.h for complete usage instructions.
48 //
49 // TO use these helpers you should include this header and the header that
50 // defines base::Bind.
51 //
52 // #include "include/base/cef_bind.h"
53 // #include "include/wrapper/cef_closure_task.h"
54 //
55 // Example of executing a bound function:
56 //
57 // // Define a function.
58 // void MyFunc(int arg) { /* do something with |arg| on the UI thread */ }
59 //
60 // // Post a task that will execute MyFunc on the UI thread and pass an |arg|
61 // // value of 5.
62 // CefPostTask(TID_UI, base::Bind(&MyFunc, 5));
63 //
64 // Example of executing a bound method:
65 //
66 // // Define a class.
67 // class MyClass : public CefBase {
68 //  public:
69 //   MyClass() {}
70 //   void MyMethod(int arg) { /* do something with |arg| on the UI thread */ }
71 //  private:
72 //   IMPLEMENT_REFCOUNTING(MyClass);
73 // };
74 //
75 // // Create an instance of MyClass.
76 // CefRefPtr<MyClass> instance = new MyClass();
77 //
78 // // Post a task that will execute MyClass::MyMethod on the UI thread and pass
79 // // an |arg| value of 5. |instance| will be kept alive until after the task
80 // // completes.
81 // CefPostTask(TID_UI, base::Bind(&MyClass::MyMethod, instance, 5));
82 ///
83
84 ///
85 // Create a CefTask that wraps a base::Closure. Can be used in combination with
86 // CefTaskRunner.
87 ///
88 CefRefPtr<CefTask> CefCreateClosureTask(const base::Closure& closure);
89
90 ///
91 // Post a Closure for execution on the specified thread.
92 ///
93 bool CefPostTask(CefThreadId threadId, const base::Closure& closure);
94
95 ///
96 // Post a Closure for delayed execution on the specified thread.
97 ///
98 bool CefPostDelayedTask(CefThreadId threadId, const base::Closure& closure,
99                         int64 delay_ms);
100
101 #endif  // CEF_INCLUDE_WRAPPER_CEF_CLOSURE_TASK_H_