OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ | 5 #ifndef REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ |
6 #define REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ | 6 #define REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual bool RunOnPluginThread( | 24 virtual bool RunOnPluginThread( |
25 int delay_ms, void(function)(void*), void* data) = 0; | 25 int delay_ms, void(function)(void*), void* data) = 0; |
26 }; | 26 }; |
27 | 27 |
28 // Caller keeps ownership of delegate. | 28 // Caller keeps ownership of delegate. |
29 PluginMessageLoopProxy(Delegate* delegate); | 29 PluginMessageLoopProxy(Delegate* delegate); |
30 virtual ~PluginMessageLoopProxy(); | 30 virtual ~PluginMessageLoopProxy(); |
31 | 31 |
32 void Detach(); | 32 void Detach(); |
33 | 33 |
34 // base::MessageLoopProxy interface. | 34 // base::MessageLoopProxy implementation. |
35 virtual bool PostTask( | |
36 const tracked_objects::Location& from_here, | |
37 Task* task) OVERRIDE; | |
38 virtual bool PostDelayedTask( | |
39 const tracked_objects::Location& from_here, | |
40 Task* task, | |
41 int64 delay_ms) OVERRIDE; | |
42 virtual bool PostNonNestableTask( | |
43 const tracked_objects::Location& from_here, | |
44 Task* task) OVERRIDE; | |
45 virtual bool PostNonNestableDelayedTask( | |
46 const tracked_objects::Location& from_here, | |
47 Task* task, | |
48 int64 delay_ms) OVERRIDE; | |
49 | |
50 virtual bool PostTask( | 35 virtual bool PostTask( |
51 const tracked_objects::Location& from_here, | 36 const tracked_objects::Location& from_here, |
52 const base::Closure& task) OVERRIDE; | 37 const base::Closure& task) OVERRIDE; |
53 virtual bool PostDelayedTask( | 38 virtual bool PostDelayedTask( |
54 const tracked_objects::Location& from_here, | 39 const tracked_objects::Location& from_here, |
55 const base::Closure& task, | 40 const base::Closure& task, |
56 int64 delay_ms) OVERRIDE; | 41 int64 delay_ms) OVERRIDE; |
57 virtual bool PostNonNestableTask( | 42 virtual bool PostNonNestableTask( |
58 const tracked_objects::Location& from_here, | 43 const tracked_objects::Location& from_here, |
59 const base::Closure& task) OVERRIDE; | 44 const base::Closure& task) OVERRIDE; |
60 virtual bool PostNonNestableDelayedTask( | 45 virtual bool PostNonNestableDelayedTask( |
61 const tracked_objects::Location& from_here, | 46 const tracked_objects::Location& from_here, |
62 const base::Closure& task, | 47 const base::Closure& task, |
63 int64 delay_ms) OVERRIDE; | 48 int64 delay_ms) OVERRIDE; |
64 | 49 |
65 virtual bool BelongsToCurrentThread() OVERRIDE; | 50 virtual bool BelongsToCurrentThread() OVERRIDE; |
66 | 51 |
67 private: | 52 private: |
68 static void TaskSpringboard(void* data); | 53 static void TaskSpringboard(void* data); |
69 | 54 |
70 void RunTaskIf(Task* task); | |
71 void RunClosureIf(const base::Closure& task); | 55 void RunClosureIf(const base::Closure& task); |
72 | 56 |
73 base::PlatformThreadId plugin_thread_id_; | 57 base::PlatformThreadId plugin_thread_id_; |
74 | 58 |
75 // |lock_| must be acquired when accessing |delegate_|. | 59 // |lock_| must be acquired when accessing |delegate_|. |
76 base::Lock lock_; | 60 base::Lock lock_; |
77 Delegate* delegate_; | 61 Delegate* delegate_; |
78 | 62 |
79 DISALLOW_COPY_AND_ASSIGN(PluginMessageLoopProxy); | 63 DISALLOW_COPY_AND_ASSIGN(PluginMessageLoopProxy); |
80 }; | 64 }; |
81 | 65 |
82 } // namespace remoting | 66 } // namespace remoting |
83 | 67 |
84 #endif // REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ | 68 #endif // REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_ |
OLD | NEW |