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

Unified Diff: remoting/host/chromoting_host_context.h

Issue 10829467: [Chromoting] Introducing refcount-based life time management of the message loops in the service (d… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback and a unit test for AutoThreadTaskRunner. Created 8 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.h
diff --git a/remoting/host/chromoting_host_context.h b/remoting/host/chromoting_host_context.h
index 2e3480d69d3a1c50f59421615d2aad0d494ce494..2a5adcbc97c038181aca0a36b7794f6fab1ec739 100644
--- a/remoting/host/chromoting_host_context.h
+++ b/remoting/host/chromoting_host_context.h
@@ -5,22 +5,17 @@
#ifndef REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
#define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
-#include <string>
-
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
-#include "base/threading/platform_thread.h"
+#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
-namespace base {
-class SingleThreadTaskRunner;
-} // namespace base
-
namespace net {
class URLRequestContextGetter;
} // namespace net
namespace remoting {
+class AutoThreadTaskRunner;
// A class that manages threads and running context for the chromoting host
// process. This class is virtual only for testing purposes (see below).
@@ -28,7 +23,7 @@ class ChromotingHostContext {
public:
// Create a context.
ChromotingHostContext(
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
+ scoped_refptr<AutoThreadTaskRunner> ui_task_runner);
virtual ~ChromotingHostContext();
// TODO(ajwong): Move the Start method out of this class. Then
@@ -38,6 +33,8 @@ class ChromotingHostContext {
// this API.
virtual bool Start();
+ void ReleaseTaskRunners();
+
// Task runner for the thread that is used for the UI. In the NPAPI
// plugin this corresponds to the main plugin thread.
virtual base::SingleThreadTaskRunner* ui_task_runner();
@@ -86,7 +83,15 @@ class ChromotingHostContext {
// Thread for blocking IO operations.
base::Thread file_thread_;
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
+ // Task runners wrapping the above threads. These should be declared after
+ // the corresponding threads to guarantee proper order of destruction.
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> desktop_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
+
+ scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;

Powered by Google App Engine
This is Rietveld 408576698