| 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 { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 /// | 100 /// |
| 101 /// - You quit the message loop via PostQuit with should_destroy set to | 101 /// - You quit the message loop via PostQuit with should_destroy set to |
| 102 /// PP_FALSE. In this case, the system will assume the message loop will be | 102 /// PP_FALSE. In this case, the system will assume the message loop will be |
| 103 /// run again later and keep your tasks. | 103 /// run again later and keep your tasks. |
| 104 /// | 104 /// |
| 105 /// To do proper shutdown, call PostQuit with should_destroy = PP_TRUE. This | 105 /// To do proper shutdown, call PostQuit with should_destroy = PP_TRUE. This |
| 106 /// will prohibit future work from being posted, and will allow the message loop | 106 /// will prohibit future work from being posted, and will allow the message loop |
| 107 /// to run until all pending tasks are run. | 107 /// to run until all pending tasks are run. |
| 108 /// | 108 /// |
| 109 /// If you post a callback to a message loop that's been destroyed, or to an | 109 /// If you post a callback to a message loop that's been destroyed, or to an |
| 110 /// invalid message loop, PostTask will return an error and will not run the | 110 /// invalid message loop, PostWork will return an error and will not run the |
| 111 /// callback. This is true even for callbacks with the "required" flag set, | 111 /// callback. This is true even for callbacks with the "required" flag set, |
| 112 /// since the system may not even know what thread to issue the error callback | 112 /// since the system may not even know what thread to issue the error callback |
| 113 /// on. | 113 /// on. |
| 114 /// | 114 /// |
| 115 /// Therefore, you should check for errors from PostWork and destroy any | 115 /// Therefore, you should check for errors from PostWork and destroy any |
| 116 /// associated memory to avoid leaks. If you're using the C++ | 116 /// associated memory to avoid leaks. If you're using the C++ |
| 117 /// CompletionCallbackFactory, use the following pattern: | 117 /// CompletionCallbackFactory, use the following pattern: |
| 118 /// | 118 /// |
| 119 /// pp::CompletionCallback callback = factory_.NewOptionalCallback(...); | 119 /// pp::CompletionCallback callback = factory_.NewOptionalCallback(...); |
| 120 /// int32_t result = message_loop.PostWork(callback); | 120 /// int32_t result = message_loop.PostWork(callback); |
| (...skipping 131 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 |