Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1493)

Side by Side Diff: remoting/base/plugin_message_loop_proxy.h

Issue 7635030: Add PluginMessageLoopProxy and use it for Host plugin UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix release build break Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
6 #define REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
7
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/message_loop_proxy.h"
11 #include "base/synchronization/lock.h"
12
13 namespace remoting {
14
15 // MessageLoopProxy for plugin main threads.
16 class PluginMessageLoopProxy : public base::MessageLoopProxy {
17 public:
18 class Delegate {
19 public:
20 Delegate() { }
21 virtual ~Delegate() { }
22
23 virtual bool RunOnPluginThread(
24 int delay_ms, void(function)(void*), void* data) = 0;
25 virtual bool IsPluginThread() = 0;
26 };
27
28 // Caller keeps ownership of delegate.
29 PluginMessageLoopProxy(Delegate* delegate);
30 virtual ~PluginMessageLoopProxy();
31
32 void Detach();
33
34 // base::MessageLoopProxy interface.
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(
51 const tracked_objects::Location& from_here,
52 const base::Closure& task) OVERRIDE;
53 virtual bool PostDelayedTask(
54 const tracked_objects::Location& from_here,
55 const base::Closure& task,
56 int64 delay_ms) OVERRIDE;
57 virtual bool PostNonNestableTask(
58 const tracked_objects::Location& from_here,
59 const base::Closure& task) OVERRIDE;
60 virtual bool PostNonNestableDelayedTask(
61 const tracked_objects::Location& from_here,
62 const base::Closure& task,
63 int64 delay_ms) OVERRIDE;
64
65 virtual bool BelongsToCurrentThread() OVERRIDE;
66
67 private:
68 // |lock_| must be acquired when accessing |delegate_|.
69 base::Lock lock_;
70 Delegate* delegate_;
71
72 static void RunTask(void* data);
73 static void RunClosure(void* data);
74
75 DISALLOW_COPY_AND_ASSIGN(PluginMessageLoopProxy);
76 };
77
78 } // namespace remoting
79
80 #endif // REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/base/plugin_message_loop_proxy.cc » ('j') | remoting/host/plugin/host_script_object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698