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

Unified Diff: remoting/host/chromoting_host_context.cc

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
Index: remoting/host/chromoting_host_context.cc
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
index 18c293f6f660c5457983ecbb6f5befe69aa2633d..c90f5b0304dad1cd8c001f38ded8aa7826f19d83 100644
--- a/remoting/host/chromoting_host_context.cc
+++ b/remoting/host/chromoting_host_context.cc
@@ -22,10 +22,12 @@ void InitializeMessageLoopProxy(
}
} // namespace
-ChromotingHostContext::ChromotingHostContext()
+ChromotingHostContext::ChromotingHostContext(
+ base::MessageLoopProxy* ui_message_loop)
: main_thread_("ChromotingMainThread"),
encode_thread_("ChromotingEncodeThread"),
- desktop_thread_("ChromotingDesktopThread") {
+ desktop_thread_("ChromotingDesktopThread"),
+ ui_message_loop_(ui_message_loop) {
}
ChromotingHostContext::~ChromotingHostContext() {
@@ -57,6 +59,10 @@ JingleThread* ChromotingHostContext::jingle_thread() {
return &jingle_thread_;
}
+base::MessageLoopProxy* ChromotingHostContext::ui_message_loop() {
+ return ui_message_loop_;
+}
+
MessageLoop* ChromotingHostContext::main_message_loop() {
return main_thread_.message_loop();
}
@@ -73,31 +79,4 @@ MessageLoop* ChromotingHostContext::desktop_message_loop() {
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

Powered by Google App Engine
This is Rietveld 408576698