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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Create threads and URLRequestContextGetter for use by a host. | 28 // Create threads and URLRequestContextGetter for use by a host. |
29 // During shutdown the caller should tear-down the ChromotingHostContext and | 29 // During shutdown the caller should tear-down the ChromotingHostContext and |
30 // then continue to run until |ui_task_runner| is no longer referenced. | 30 // then continue to run until |ui_task_runner| is no longer referenced. |
31 // nullptr is returned if any threads fail to start. | 31 // nullptr is returned if any threads fail to start. |
32 static scoped_ptr<ChromotingHostContext> Create( | 32 static scoped_ptr<ChromotingHostContext> Create( |
33 scoped_refptr<AutoThreadTaskRunner> ui_task_runner); | 33 scoped_refptr<AutoThreadTaskRunner> ui_task_runner); |
34 | 34 |
35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
36 // Attaches task runners to the relevant browser threads for the chromoting | 36 // Attaches task runners to the relevant browser threads for the chromoting |
37 // host. Must be called on the UI thread of the browser process. | 37 // host. Must be called on the UI thread of the browser process. |
38 // remoting::UrlRequestContextGetter returns BasicURLRequestContext under | 38 // remoting::UrlRequestContextGetter returns ContainerURLRequestContext under |
39 // the hood which spawns two new threads per instance. Since | 39 // the hood which spawns two new threads per instance. Since |
40 // ChromotingHostContext can be destroyed from any thread, as its owner | 40 // ChromotingHostContext can be destroyed from any thread, as its owner |
41 // (It2MeHost) is ref-counted, joining the created threads during shutdown | 41 // (It2MeHost) is ref-counted, joining the created threads during shutdown |
42 // violates the "Disallow IO" thread restrictions on some task runners (e.g. | 42 // violates the "Disallow IO" thread restrictions on some task runners (e.g. |
43 // the IO Thread of the browser process). | 43 // the IO Thread of the browser process). |
44 // Instead, we re-use the |url_request_context_getter| in the browser process. | 44 // Instead, we re-use the |url_request_context_getter| in the browser process. |
45 static scoped_ptr<ChromotingHostContext> CreateForChromeOS( | 45 static scoped_ptr<ChromotingHostContext> CreateForChromeOS( |
46 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 46 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 48 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Serves URLRequestContexts that use the network and UI task runners. | 120 // Serves URLRequestContexts that use the network and UI task runners. |
121 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 121 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 123 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace remoting | 126 } // namespace remoting |
127 | 127 |
128 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 128 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
OLD | NEW |