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

Unified 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: - 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/base/plugin_message_loop_proxy.cc » ('j') | remoting/host/desktop_environment.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/plugin_message_loop_proxy.h
diff --git a/remoting/base/plugin_message_loop_proxy.h b/remoting/base/plugin_message_loop_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba0b15e96e48dee437cfa5fa931ddc7def6010a9
--- /dev/null
+++ b/remoting/base/plugin_message_loop_proxy.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
+#define REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/message_loop_proxy.h"
+
+namespace remoting {
+
+// MessageLoopProxy for plugin main threads.
+class PluginMessageLoopProxy : public base::MessageLoopProxy {
+ public:
+ class Delegate {
+ public:
+ Delegate() { }
+ virtual ~Delegate() { }
+
+ virtual bool RunOnPluginThread(
+ int delay_ms, void(function)(void*), void* data) = 0;
Wez 2011/08/15 20:28:19 Given that there needs to be a separate Delegate i
Sergey Ulanov 2011/08/15 22:39:52 We will need to move the closure to the heap anywa
+ virtual bool IsPluginThread() = 0;
+ };
+
+ // Caller keeps ownership of delegate.
+ PluginMessageLoopProxy(Delegate* delegate);
+ virtual ~PluginMessageLoopProxy();
+
+ void Detach();
+
+ // base::MessageLoopProxy interface.
+ virtual bool PostTask(const tracked_objects::Location& from_here,
+ Task* task) OVERRIDE;
+ virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
+ Task* task,
+ int64 delay_ms) OVERRIDE;
+ virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
+ Task* task) OVERRIDE;
Wez 2011/08/15 20:28:19 nit: Can we wrap the parameters for these three si
Sergey Ulanov 2011/08/15 22:39:52 Done.
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ Task* task,
+ int64 delay_ms) OVERRIDE;
+
+ virtual bool PostTask(const tracked_objects::Location& from_here,
+ const base::Closure& task) OVERRIDE;
+ virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ int64 delay_ms) OVERRIDE;
+ virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
+ const base::Closure& task) OVERRIDE;
+ virtual bool PostNonNestableDelayedTask(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ int64 delay_ms) OVERRIDE;
+
+ virtual bool BelongsToCurrentThread() OVERRIDE;
+
+ private:
+ // |lock_| must be acquired when accessing |delegate_|.
+ base::Lock lock_;
+ Delegate* delegate_;
+
+ static void RunTask(void* data);
+ static void RunClosure(void* data);
+
+ DISALLOW_COPY_AND_ASSIGN(PluginMessageLoopProxy);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_PLUGIN_MESSAGE_LOOP_H_
« no previous file with comments | « no previous file | remoting/base/plugin_message_loop_proxy.cc » ('j') | remoting/host/desktop_environment.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698