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_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
14 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
15 #include "ppapi/proxy/ppapi_proxy_export.h" | 17 #include "ppapi/proxy/ppapi_proxy_export.h" |
16 #include "ppapi/shared_impl/ppb_message_loop_shared.h" | 18 #include "ppapi/shared_impl/ppb_message_loop_shared.h" |
17 #include "ppapi/thunk/ppb_message_loop_api.h" | 19 #include "ppapi/thunk/ppb_message_loop_api.h" |
18 | 20 |
19 struct PPB_MessageLoop_1_0; | 21 struct PPB_MessageLoop_1_0; |
(...skipping 29 matching lines...) Expand all Loading... |
49 } | 51 } |
50 | 52 |
51 void set_currently_handling_blocking_message(bool handling_blocking_message) { | 53 void set_currently_handling_blocking_message(bool handling_blocking_message) { |
52 currently_handling_blocking_message_ = handling_blocking_message; | 54 currently_handling_blocking_message_ = handling_blocking_message; |
53 } | 55 } |
54 | 56 |
55 private: | 57 private: |
56 struct TaskInfo { | 58 struct TaskInfo { |
57 tracked_objects::Location from_here; | 59 tracked_objects::Location from_here; |
58 base::Closure closure; | 60 base::Closure closure; |
59 int64 delay_ms; | 61 int64_t delay_ms; |
60 }; | 62 }; |
61 | 63 |
62 // Returns true if the object is associated with the current thread. | 64 // Returns true if the object is associated with the current thread. |
63 bool IsCurrent() const; | 65 bool IsCurrent() const; |
64 | 66 |
65 // MessageLoopShared implementation. | 67 // MessageLoopShared implementation. |
66 // | 68 // |
67 // Handles posting to the message loop if there is one, or the pending queue | 69 // Handles posting to the message loop if there is one, or the pending queue |
68 // if there isn't. | 70 // if there isn't. |
69 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock. | 71 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock. |
70 // This only makes sense for user code and completely thread-safe | 72 // This only makes sense for user code and completely thread-safe |
71 // proxy operations (e.g., MessageLoop::QuitClosure). | 73 // proxy operations (e.g., MessageLoop::QuitClosure). |
72 void PostClosure(const tracked_objects::Location& from_here, | 74 void PostClosure(const tracked_objects::Location& from_here, |
73 const base::Closure& closure, | 75 const base::Closure& closure, |
74 int64 delay_ms) override; | 76 int64_t delay_ms) override; |
75 base::SingleThreadTaskRunner* GetTaskRunner() override; | 77 base::SingleThreadTaskRunner* GetTaskRunner() override; |
76 bool CurrentlyHandlingBlockingMessage() override; | 78 bool CurrentlyHandlingBlockingMessage() override; |
77 | 79 |
78 // TLS destructor function. | 80 // TLS destructor function. |
79 static void ReleaseMessageLoop(void* value); | 81 static void ReleaseMessageLoop(void* value); |
80 | 82 |
81 // Created when we attach to the current thread, since MessageLoop assumes | 83 // Created when we attach to the current thread, since MessageLoop assumes |
82 // that it's created on the thread it will run on. NULL for the main thread | 84 // that it's created on the thread it will run on. NULL for the main thread |
83 // loop, since that's owned by somebody else. This is needed for Run and Quit. | 85 // loop, since that's owned by somebody else. This is needed for Run and Quit. |
84 // Any time we post tasks, we should post them using task_runner_. | 86 // Any time we post tasks, we should post them using task_runner_. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 static const PPB_MessageLoop_1_0* GetInterface(); | 118 static const PPB_MessageLoop_1_0* GetInterface(); |
117 | 119 |
118 private: | 120 private: |
119 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); | 121 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); |
120 }; | 122 }; |
121 | 123 |
122 } // namespace proxy | 124 } // namespace proxy |
123 } // namespace ppapi | 125 } // namespace ppapi |
124 | 126 |
125 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ | 127 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ |
OLD | NEW |