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

Unified Diff: remoting/host/chromoting_host_context.cc

Issue 7655006: Revert 97050 - 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 | « remoting/host/chromoting_host_context.h ('k') | remoting/host/chromoting_host_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host_context.cc
===================================================================
--- remoting/host/chromoting_host_context.cc (revision 97052)
+++ remoting/host/chromoting_host_context.cc (working copy)
@@ -12,12 +12,10 @@
namespace remoting {
-ChromotingHostContext::ChromotingHostContext(
- base::MessageLoopProxy* ui_message_loop)
+ChromotingHostContext::ChromotingHostContext()
: main_thread_("ChromotingMainThread"),
encode_thread_("ChromotingEncodeThread"),
- desktop_thread_("ChromotingDesktopThread"),
- ui_message_loop_(ui_message_loop) {
+ desktop_thread_("ChromotingDesktopThread") {
}
ChromotingHostContext::~ChromotingHostContext() {
@@ -43,10 +41,6 @@
return &jingle_thread_;
}
-base::MessageLoopProxy* ChromotingHostContext::ui_message_loop() {
- return ui_message_loop_;
-}
-
MessageLoop* ChromotingHostContext::main_message_loop() {
return main_thread_.message_loop();
}
@@ -63,4 +57,31 @@
return desktop_thread_.message_loop();
}
+void ChromotingHostContext::SetUITaskPostFunction(
+ const UIThreadPostTaskFunction& poster) {
+ ui_poster_ = poster;
+ ui_main_thread_id_ = base::PlatformThread::CurrentId();
+}
+
+void ChromotingHostContext::PostTaskToUIThread(
+ const tracked_objects::Location& from_here, const base::Closure& task) {
+ ui_poster_.Run(from_here, task);
+}
+
+void ChromotingHostContext::PostDelayedTaskToUIThread(
+ const tracked_objects::Location& from_here,
+ const base::Closure& task,
+ int delay_ms) {
+ // Post delayed task on the main thread that will post task on UI
+ // thread. It is safe to use base::Unretained() here because
+ // ChromotingHostContext owns |main_thread_|.
+ main_message_loop()->PostDelayedTask(from_here, base::Bind(
+ &ChromotingHostContext::PostTaskToUIThread, base::Unretained(this),
+ from_here, task), delay_ms);
+}
+
+bool ChromotingHostContext::IsUIThread() const {
+ return ui_main_thread_id_ == base::PlatformThread::CurrentId();
+}
+
} // namespace remoting
« no previous file with comments | « remoting/host/chromoting_host_context.h ('k') | remoting/host/chromoting_host_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698