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 "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared { | 23 class PPAPI_PROXY_EXPORT MessageLoopResource : public MessageLoopShared { |
24 public: | 24 public: |
25 explicit MessageLoopResource(PP_Instance instance); | 25 explicit MessageLoopResource(PP_Instance instance); |
26 // Construct the one MessageLoopResource for the main thread. This must be | 26 // Construct the one MessageLoopResource for the main thread. This must be |
27 // invoked on the main thread. | 27 // invoked on the main thread. |
28 explicit MessageLoopResource(ForMainThread); | 28 explicit MessageLoopResource(ForMainThread); |
29 virtual ~MessageLoopResource(); | 29 virtual ~MessageLoopResource(); |
30 | 30 |
31 // Resource overrides. | 31 // Resource overrides. |
32 virtual thunk::PPB_MessageLoop_API* AsPPB_MessageLoop_API() OVERRIDE; | 32 virtual thunk::PPB_MessageLoop_API* AsPPB_MessageLoop_API() override; |
33 | 33 |
34 // PPB_MessageLoop_API implementation. | 34 // PPB_MessageLoop_API implementation. |
35 virtual int32_t AttachToCurrentThread() OVERRIDE; | 35 virtual int32_t AttachToCurrentThread() override; |
36 virtual int32_t Run() OVERRIDE; | 36 virtual int32_t Run() override; |
37 virtual int32_t PostWork(PP_CompletionCallback callback, | 37 virtual int32_t PostWork(PP_CompletionCallback callback, |
38 int64_t delay_ms) OVERRIDE; | 38 int64_t delay_ms) override; |
39 virtual int32_t PostQuit(PP_Bool should_destroy) OVERRIDE; | 39 virtual int32_t PostQuit(PP_Bool should_destroy) override; |
40 | 40 |
41 static MessageLoopResource* GetCurrent(); | 41 static MessageLoopResource* GetCurrent(); |
42 void DetachFromThread(); | 42 void DetachFromThread(); |
43 bool is_main_thread_loop() const { | 43 bool is_main_thread_loop() const { |
44 return is_main_thread_loop_; | 44 return is_main_thread_loop_; |
45 } | 45 } |
46 | 46 |
47 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy() { | 47 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy() { |
48 return loop_proxy_; | 48 return loop_proxy_; |
49 } | 49 } |
(...skipping 14 matching lines...) Expand all Loading... |
64 | 64 |
65 // MessageLoopShared implementation. | 65 // MessageLoopShared implementation. |
66 // | 66 // |
67 // Handles posting to the message loop if there is one, or the pending queue | 67 // Handles posting to the message loop if there is one, or the pending queue |
68 // if there isn't. | 68 // if there isn't. |
69 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock. | 69 // NOTE: The given closure will be run *WITHOUT* acquiring the Proxy lock. |
70 // This only makes sense for user code and completely thread-safe | 70 // This only makes sense for user code and completely thread-safe |
71 // proxy operations (e.g., MessageLoop::QuitClosure). | 71 // proxy operations (e.g., MessageLoop::QuitClosure). |
72 virtual void PostClosure(const tracked_objects::Location& from_here, | 72 virtual void PostClosure(const tracked_objects::Location& from_here, |
73 const base::Closure& closure, | 73 const base::Closure& closure, |
74 int64 delay_ms) OVERRIDE; | 74 int64 delay_ms) override; |
75 virtual base::MessageLoopProxy* GetMessageLoopProxy() OVERRIDE; | 75 virtual base::MessageLoopProxy* GetMessageLoopProxy() override; |
76 virtual bool CurrentlyHandlingBlockingMessage() OVERRIDE; | 76 virtual bool CurrentlyHandlingBlockingMessage() override; |
77 | 77 |
78 // TLS destructor function. | 78 // TLS destructor function. |
79 static void ReleaseMessageLoop(void* value); | 79 static void ReleaseMessageLoop(void* value); |
80 | 80 |
81 // Created when we attach to the current thread, since MessageLoop assumes | 81 // 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 | 82 // 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. | 83 // 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 loop_proxy_. | 84 // Any time we post tasks, we should post them using loop_proxy_. |
85 scoped_ptr<base::MessageLoop> loop_; | 85 scoped_ptr<base::MessageLoop> loop_; |
86 scoped_refptr<base::MessageLoopProxy> loop_proxy_; | 86 scoped_refptr<base::MessageLoopProxy> loop_proxy_; |
(...skipping 29 matching lines...) Expand all Loading... |
116 static const PPB_MessageLoop_1_0* GetInterface(); | 116 static const PPB_MessageLoop_1_0* GetInterface(); |
117 | 117 |
118 private: | 118 private: |
119 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); | 119 DISALLOW_COPY_AND_ASSIGN(PPB_MessageLoop_Proxy); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace proxy | 122 } // namespace proxy |
123 } // namespace ppapi | 123 } // namespace ppapi |
124 | 124 |
125 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ | 125 #endif // PPAPI_PROXY_PPB_MESSAGE_LOOP_PROXY_H_ |
OLD | NEW |