OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ |
6 #define PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ | 6 #define PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ |
7 | 7 |
8 #include "ppapi/cpp/resource.h" | 8 #include "ppapi/cpp/resource.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 | 11 |
12 class CompletionCallback; | 12 class CompletionCallback; |
13 class Instance; | 13 class InstanceHandle; |
14 | 14 |
15 /// A message loop allows PPAPI calls to be issued on a thread. You may not | 15 /// A message loop allows PPAPI calls to be issued on a thread. You may not |
16 /// issue any API calls on a thread without creating a message loop. It also | 16 /// issue any API calls on a thread without creating a message loop. It also |
17 /// allows you to post work to the message loop for a thread. | 17 /// allows you to post work to the message loop for a thread. |
18 /// | 18 /// |
19 /// To process work posted to the message loop, as well as completion callbacks | 19 /// To process work posted to the message loop, as well as completion callbacks |
20 /// for asynchronous operations, you must run the message loop via Run(). | 20 /// for asynchronous operations, you must run the message loop via Run(). |
21 /// | 21 /// |
22 /// Note the system manages the lifetime of the instance (and all associated | 22 /// Note the system manages the lifetime of the instance (and all associated |
23 /// resources). If the instance is deleted from the page, background threads may | 23 /// resources). If the instance is deleted from the page, background threads may |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 public: | 128 public: |
129 /// Creates an is_null() MessageLoop resource. | 129 /// Creates an is_null() MessageLoop resource. |
130 MessageLoop_Dev(); | 130 MessageLoop_Dev(); |
131 | 131 |
132 /// Creates a message loop associated with the given instance. The resource | 132 /// Creates a message loop associated with the given instance. The resource |
133 /// will be is_null() on failure. | 133 /// will be is_null() on failure. |
134 /// | 134 /// |
135 /// This may be called from any thread. After your thread starts but before | 135 /// This may be called from any thread. After your thread starts but before |
136 /// issuing any other PPAPI calls on it, you must associate it with a message | 136 /// issuing any other PPAPI calls on it, you must associate it with a message |
137 /// loop by calling AttachToCurrentThread. | 137 /// loop by calling AttachToCurrentThread. |
138 explicit MessageLoop_Dev(Instance* instance); | 138 explicit MessageLoop_Dev(const InstanceHandle& instance); |
139 | 139 |
140 MessageLoop_Dev(const MessageLoop_Dev& other); | 140 MessageLoop_Dev(const MessageLoop_Dev& other); |
141 | 141 |
142 /// Takes an additional ref to the resource. | 142 /// Takes an additional ref to the resource. |
143 explicit MessageLoop_Dev(PP_Resource pp_message_loop); | 143 explicit MessageLoop_Dev(PP_Resource pp_message_loop); |
144 | 144 |
145 static MessageLoop_Dev GetForMainThread(); | 145 static MessageLoop_Dev GetForMainThread(); |
146 static MessageLoop_Dev GetCurrent(); | 146 static MessageLoop_Dev GetCurrent(); |
147 | 147 |
148 /// Sets the given message loop resource as being the associated message loop | 148 /// Sets the given message loop resource as being the associated message loop |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 /// - PP_ERROR_BADRESOURCE: The message loop was invalid. | 252 /// - PP_ERROR_BADRESOURCE: The message loop was invalid. |
253 /// - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. | 253 /// - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. |
254 /// The main thread's message loop is managed by the system and can't be | 254 /// The main thread's message loop is managed by the system and can't be |
255 /// quit. | 255 /// quit. |
256 int32_t PostQuit(bool should_destroy); | 256 int32_t PostQuit(bool should_destroy); |
257 }; | 257 }; |
258 | 258 |
259 } // namespace pp | 259 } // namespace pp |
260 | 260 |
261 #endif // PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ | 261 #endif // PPAPI_CPP_DEV_MESSAGE_LOOP_DEV_H_ |
OLD | NEW |