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

Side by Side 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. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
6 #define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ 6 #define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
7 7
8 #include <string>
9
10 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
12 #include "base/threading/platform_thread.h" 10 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
14 12
15 namespace base {
16 class SingleThreadTaskRunner;
17 } // namespace base
18
19 namespace net { 13 namespace net {
20 class URLRequestContextGetter; 14 class URLRequestContextGetter;
21 } // namespace net 15 } // namespace net
22 16
23 namespace remoting { 17 namespace remoting {
24 18
25 // A class that manages threads and running context for the chromoting host 19 // A class that manages threads and running context for the chromoting host
26 // process. This class is virtual only for testing purposes (see below). 20 // process. This class is virtual only for testing purposes (see below).
27 class ChromotingHostContext { 21 class ChromotingHostContext {
28 public: 22 public:
29 // Create a context. 23 // Create a context.
30 ChromotingHostContext( 24 ChromotingHostContext(
31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 25 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
32 virtual ~ChromotingHostContext(); 26 virtual ~ChromotingHostContext();
33 27
34 // TODO(ajwong): Move the Start method out of this class. Then 28 // TODO(ajwong): Move the Start method out of this class. Then
35 // create a static factory for construction, and destruction. We 29 // create a static factory for construction, and destruction. We
36 // should be able to remove the need for virtual functions below 30 // should be able to remove the need for virtual functions below
37 // with that design, while preserving the relative simplicity of 31 // with that design, while preserving the relative simplicity of
38 // this API. 32 // this API.
39 virtual bool Start(); 33 virtual bool Start();
40 34
35 void Stop();
Sergey Ulanov 2012/08/31 01:25:18 Seems wrong to call this method Stop() given that
alexeypa (please no reviews) 2012/08/31 19:57:36 Done. ReleaseTaskRunners()
36
41 // Task runner for the thread that is used for the UI. In the NPAPI 37 // Task runner for the thread that is used for the UI. In the NPAPI
42 // plugin this corresponds to the main plugin thread. 38 // plugin this corresponds to the main plugin thread.
43 virtual base::SingleThreadTaskRunner* ui_task_runner(); 39 virtual base::SingleThreadTaskRunner* ui_task_runner();
44 40
45 // Task runner for the thread used by the ScreenRecorder to capture 41 // Task runner for the thread used by the ScreenRecorder to capture
46 // the screen. 42 // the screen.
47 virtual base::SingleThreadTaskRunner* capture_task_runner(); 43 virtual base::SingleThreadTaskRunner* capture_task_runner();
48 44
49 // Task runner for the thread used to encode video streams. 45 // Task runner for the thread used to encode video streams.
50 virtual base::SingleThreadTaskRunner* encode_task_runner(); 46 virtual base::SingleThreadTaskRunner* encode_task_runner();
(...skipping 28 matching lines...) Expand all
79 75
80 // A thread that hosts all encode operations. 76 // A thread that hosts all encode operations.
81 base::Thread encode_thread_; 77 base::Thread encode_thread_;
82 78
83 // A thread that hosts input injection. 79 // A thread that hosts input injection.
84 base::Thread desktop_thread_; 80 base::Thread desktop_thread_;
85 81
86 // Thread for blocking IO operations. 82 // Thread for blocking IO operations.
87 base::Thread file_thread_; 83 base::Thread file_thread_;
88 84
85 // Task runners wrapping the above threads. These should be declared after
86 // the corresponding threads to guarantee proper order of destruction.
87 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
88 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
89 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
90 scoped_refptr<base::SingleThreadTaskRunner> desktop_task_runner_;
91 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
92
89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 93 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
90 94
91 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 95 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
92 96
93 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); 97 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext);
94 }; 98 };
95 99
96 } // namespace remoting 100 } // namespace remoting
97 101
98 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ 102 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698