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