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

Unified Diff: remoting/host/chromoting_host_context.cc

Issue 2829018: Fix thread usage in chromoting host (Closed)
Patch Set: removed useless test Created 10 years, 6 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
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2f889a15db42b639a1063683e088d422f263a126
--- /dev/null
+++ b/remoting/host/chromoting_host_context.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 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.
+
+#include "remoting/host/chromoting_host_context.h"
+
+#include <string>
+
+#include "base/thread.h"
+#include "remoting/jingle_glue/jingle_thread.h"
+
+namespace remoting {
+
+ChromotingHostContext::ChromotingHostContext()
+ : main_thread_("ChromotingMainThread"),
+ capture_thread_("ChromotingCaptureThread"),
+ encode_thread_("ChromotingEncodeThread") {
+}
+
+ChromotingHostContext::~ChromotingHostContext() {
+}
+
+void ChromotingHostContext::Start() {
+ // Start all the threads.
+ main_thread_.StartWithOptions(
+ base::Thread::Options(MessageLoop::TYPE_UI, 0));
+ capture_thread_.Start();
+ encode_thread_.Start();
+ jingle_thread_.Start();
+}
+
+void ChromotingHostContext::Stop() {
+ // Stop all the threads.
+ jingle_thread_.Stop();
+ encode_thread_.Stop();
+ capture_thread_.Stop();
+ main_thread_.Stop();
+}
+
+JingleThread* ChromotingHostContext::jingle_thread() {
+ return &jingle_thread_;
+}
+
+MessageLoop* ChromotingHostContext::main_message_loop() {
+ return main_thread_.message_loop();
+}
+
+MessageLoop* ChromotingHostContext::capture_message_loop() {
+ return capture_thread_.message_loop();
+}
+
+MessageLoop* ChromotingHostContext::encode_message_loop() {
+ return encode_thread_.message_loop();
+}
+
+} // 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