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

Side by Side Diff: remoting/host/chromoting_host_context.h

Issue 639233002: Remote assistance on Chrome OS Part IV - It2MeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ChromotingHostContext cleanup Created 6 years, 2 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
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 "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 namespace net { 12 namespace net {
13 class URLRequestContextGetter; 13 class URLRequestContextGetter;
14 } // namespace net 14 } // namespace net
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 class AutoThreadTaskRunner; 18 class AutoThreadTaskRunner;
19 19
20 // A class that manages threads and running context for the chromoting host 20 // A class that manages threads and running context for the chromoting host
21 // process. This class is virtual only for testing purposes (see below). 21 // process. This class is virtual only for testing purposes (see below).
22 class ChromotingHostContext { 22 class ChromotingHostContext {
23 public: 23 public:
24 ~ChromotingHostContext();
25
26 // Create threads and URLRequestContextGetter for use by a host. 24 // Create threads and URLRequestContextGetter for use by a host.
27 // During shutdown the caller should tear-down the ChromotingHostContext and 25 // During shutdown the caller should tear-down the ChromotingHostContext and
28 // then continue to run until |ui_task_runner| is no longer referenced. 26 // then continue to run until |ui_task_runner| is no longer referenced.
29 // NULL is returned if any threads fail to start. 27 // NULL is returned if any threads fail to start.
30 static scoped_ptr<ChromotingHostContext> Create( 28 static scoped_ptr<ChromotingHostContext> Create(
31 scoped_refptr<AutoThreadTaskRunner> ui_task_runner); 29 scoped_refptr<AutoThreadTaskRunner> ui_task_runner);
32 30
31 #if defined(OS_CHROMEOS)
32 // Must be called on the UI thread of the browser process.
Wez 2014/10/24 00:28:48 nit: Document what it does, e.g. attaches task run
kelvinp 2014/10/24 21:39:41 Done.
33 static scoped_ptr<ChromotingHostContext> CreateForChromeOS(
34 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
35 #endif // defined(OS_CHROMEOS)
36
37 ~ChromotingHostContext();
38
39 scoped_ptr<ChromotingHostContext> Copy();
40
41 // Task runner for the thread that is used for the UI.
42 scoped_refptr<AutoThreadTaskRunner> ui_task_runner();
43
33 // Task runner for the thread used for audio capture and encoding. 44 // Task runner for the thread used for audio capture and encoding.
34 scoped_refptr<AutoThreadTaskRunner> audio_task_runner(); 45 scoped_refptr<AutoThreadTaskRunner> audio_task_runner();
35 46
36 // Task runner for the thread that is used for blocking file 47 // Task runner for the thread that is used for blocking file
37 // IO. This thread is used by the URLRequestContext to read proxy 48 // IO. This thread is used by the URLRequestContext to read proxy
38 // configuration and by NatConfig to read policy configs. 49 // configuration and by NatConfig to read policy configs.
39 scoped_refptr<AutoThreadTaskRunner> file_task_runner(); 50 scoped_refptr<AutoThreadTaskRunner> file_task_runner();
40 51
41 // Task runner for the thread that is used by the InputInjector. 52 // Task runner for the thread that is used by the InputInjector.
42 // 53 //
43 // TODO(sergeyu): Do we need a separate thread for InputInjector? 54 // TODO(sergeyu): Do we need a separate thread for InputInjector?
44 // Can we use some other thread instead? 55 // Can we use some other thread instead?
45 scoped_refptr<AutoThreadTaskRunner> input_task_runner(); 56 scoped_refptr<AutoThreadTaskRunner> input_task_runner();
46 57
47 // Task runner for the thread used for network IO. This thread runs 58 // Task runner for the thread used for network IO. This thread runs
48 // a libjingle message loop, and is the only thread on which 59 // a libjingle message loop, and is the only thread on which
49 // libjingle code may be run. 60 // libjingle code may be run.
50 scoped_refptr<AutoThreadTaskRunner> network_task_runner(); 61 scoped_refptr<AutoThreadTaskRunner> network_task_runner();
51 62
52 // Task runner for the thread that is used for the UI.
53 scoped_refptr<AutoThreadTaskRunner> ui_task_runner();
54
55 // Task runner for the thread used by the ScreenRecorder to capture 63 // Task runner for the thread used by the ScreenRecorder to capture
56 // the screen. 64 // the screen.
57 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner(); 65 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner();
58 66
59 // Task runner for the thread used to encode video streams. 67 // Task runner for the thread used to encode video streams.
60 scoped_refptr<AutoThreadTaskRunner> video_encode_task_runner(); 68 scoped_refptr<AutoThreadTaskRunner> video_encode_task_runner();
61 69
62 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter(); 70 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter();
63 71
64 private: 72 private:
65 ChromotingHostContext(AutoThreadTaskRunner* ui_task_runner); 73 ChromotingHostContext(
74 scoped_refptr<AutoThreadTaskRunner> ui_task_runner,
75 scoped_refptr<AutoThreadTaskRunner> audio_task_runner,
76 scoped_refptr<AutoThreadTaskRunner> file_task_runner,
77 scoped_refptr<AutoThreadTaskRunner> input_task_runner,
78 scoped_refptr<AutoThreadTaskRunner> network_task_runner,
79 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner,
80 scoped_refptr<AutoThreadTaskRunner> video_encode_task_runner,
81 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter);
82
83 // Caller-supplied UI thread. This is usually the application main thread.
84 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
66 85
67 // Thread for audio capture and encoding. 86 // Thread for audio capture and encoding.
68 scoped_refptr<AutoThreadTaskRunner> audio_task_runner_; 87 scoped_refptr<AutoThreadTaskRunner> audio_task_runner_;
69 88
70 // Thread for I/O operations. 89 // Thread for I/O operations.
71 scoped_refptr<AutoThreadTaskRunner> file_task_runner_; 90 scoped_refptr<AutoThreadTaskRunner> file_task_runner_;
72 91
73 // Thread for input injection. 92 // Thread for input injection.
74 scoped_refptr<AutoThreadTaskRunner> input_task_runner_; 93 scoped_refptr<AutoThreadTaskRunner> input_task_runner_;
75 94
76 // Thread for network operations. 95 // Thread for network operations.
77 scoped_refptr<AutoThreadTaskRunner> network_task_runner_; 96 scoped_refptr<AutoThreadTaskRunner> network_task_runner_;
78 97
79 // Caller-supplied UI thread. This is usually the application main thread.
80 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
81
82 // Thread for screen capture. 98 // Thread for screen capture.
83 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_; 99 scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner_;
84 100
85 // Thread for video encoding. 101 // Thread for video encoding.
86 scoped_refptr<AutoThreadTaskRunner> video_encode_task_runner_; 102 scoped_refptr<AutoThreadTaskRunner> video_encode_task_runner_;
87 103
88 // Serves URLRequestContexts that use the network and UI task runners. 104 // Serves URLRequestContexts that use the network and UI task runners.
89 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 105 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
90 106
91 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); 107 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext);
92 }; 108 };
93 109
94 } // namespace remoting 110 } // namespace remoting
95 111
96 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ 112 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698