OLD | NEW |
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 base { | |
13 class SingleThreadTaskRunner; | |
14 } // namespace base | |
15 | |
16 namespace net { | 12 namespace net { |
17 class URLRequestContextGetter; | 13 class URLRequestContextGetter; |
18 } // namespace net | 14 } // namespace net |
19 | 15 |
20 namespace remoting { | 16 namespace remoting { |
21 | 17 |
22 class AutoThreadTaskRunner; | 18 class AutoThreadTaskRunner; |
23 | 19 |
24 // 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 |
25 // process. This class is virtual only for testing purposes (see below). | 21 // process. This class is virtual only for testing purposes (see below). |
(...skipping 10 matching lines...) Expand all Loading... |
36 // Attaches task runners to the relevant browser threads for the chromoting | 32 // Attaches task runners to the relevant browser threads for the chromoting |
37 // host. Must be called on the UI thread of the browser process. | 33 // host. Must be called on the UI thread of the browser process. |
38 // remoting::UrlRequestContextGetter returns BasicURLRequestContext under | 34 // remoting::UrlRequestContextGetter returns BasicURLRequestContext under |
39 // the hood which spawns two new threads per instance. Since | 35 // the hood which spawns two new threads per instance. Since |
40 // ChromotingHostContext can be destroyed from any thread, as its owner | 36 // ChromotingHostContext can be destroyed from any thread, as its owner |
41 // (It2MeHost) is ref-counted, joining the created threads during shutdown | 37 // (It2MeHost) is ref-counted, joining the created threads during shutdown |
42 // violates the "Disallow IO" thread restrictions on some task runners (e.g. | 38 // violates the "Disallow IO" thread restrictions on some task runners (e.g. |
43 // the IO Thread of the browser process). | 39 // the IO Thread of the browser process). |
44 // Instead, we re-use the |url_request_context_getter| in the browser process. | 40 // Instead, we re-use the |url_request_context_getter| in the browser process. |
45 static scoped_ptr<ChromotingHostContext> CreateForChromeOS( | 41 static scoped_ptr<ChromotingHostContext> CreateForChromeOS( |
46 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 42 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | |
48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
49 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); | |
50 #endif // defined(OS_CHROMEOS) | 43 #endif // defined(OS_CHROMEOS) |
51 | 44 |
52 ~ChromotingHostContext(); | 45 ~ChromotingHostContext(); |
53 | 46 |
54 scoped_ptr<ChromotingHostContext> Copy(); | 47 scoped_ptr<ChromotingHostContext> Copy(); |
55 | 48 |
56 // Task runner for the thread that is used for the UI. | 49 // Task runner for the thread that is used for the UI. |
57 scoped_refptr<AutoThreadTaskRunner> ui_task_runner() const; | 50 scoped_refptr<AutoThreadTaskRunner> ui_task_runner() const; |
58 | 51 |
59 // Task runner for the thread used for audio capture and encoding. | 52 // Task runner for the thread used for audio capture and encoding. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 112 |
120 // Serves URLRequestContexts that use the network and UI task runners. | 113 // Serves URLRequestContexts that use the network and UI task runners. |
121 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 114 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
122 | 115 |
123 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 116 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); |
124 }; | 117 }; |
125 | 118 |
126 } // namespace remoting | 119 } // namespace remoting |
127 | 120 |
128 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 121 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
OLD | NEW |