Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace IPC { | |
| 20 class ChannelProxy; | |
| 21 class Listener; | |
| 22 } // namespace IPC | |
| 23 | |
| 19 namespace net { | 24 namespace net { |
| 20 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 21 } // namespace net | 26 } // namespace net |
| 22 | 27 |
| 23 namespace remoting { | 28 namespace remoting { |
| 24 | 29 |
| 25 // A class that manages threads and running context for the chromoting host | 30 // A class that manages threads and running context for the chromoting host |
| 26 // process. This class is virtual only for testing purposes (see below). | 31 // process. This class is virtual only for testing purposes (see below). |
| 27 class ChromotingHostContext { | 32 class ChromotingHostContext { |
| 28 public: | 33 public: |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 58 // | 63 // |
| 59 // TODO(sergeyu): Do we need a separate thread for EventExecutor? | 64 // TODO(sergeyu): Do we need a separate thread for EventExecutor? |
| 60 // Can we use some other thread instead? | 65 // Can we use some other thread instead? |
| 61 virtual base::SingleThreadTaskRunner* desktop_task_runner(); | 66 virtual base::SingleThreadTaskRunner* desktop_task_runner(); |
| 62 | 67 |
| 63 // Task runner for the thread that is used for blocking file | 68 // Task runner for the thread that is used for blocking file |
| 64 // IO. This thread is used by the URLRequestContext to read proxy | 69 // IO. This thread is used by the URLRequestContext to read proxy |
| 65 // configuration and by NatConfig to read policy configs. | 70 // configuration and by NatConfig to read policy configs. |
| 66 virtual base::SingleThreadTaskRunner* file_task_runner(); | 71 virtual base::SingleThreadTaskRunner* file_task_runner(); |
| 67 | 72 |
| 73 // Returns a pointer to the IPC channel connecting this process with | |
| 74 // the daemon process. NULL can be returned if no channel exists. | |
|
simonmorris
2012/08/16 20:43:02
"can be" -> "is".
alexeypa (please no reviews)
2012/08/16 20:53:52
Done.
| |
| 75 IPC::ChannelProxy* daemon_channel(); | |
| 76 | |
| 77 // Connects to the endpoint provided by the daemon procesess. | |
|
simonmorris
2012/08/16 20:43:02
"process", or "processes"?
alexeypa (please no reviews)
2012/08/16 20:53:52
Done.
| |
| 78 void ConnectToDaemon(const std::string& channel_name, | |
| 79 IPC::Listener* listener); | |
| 80 | |
| 81 // Disconnects from the daemon procesess. | |
|
simonmorris
2012/08/16 20:43:02
same
alexeypa (please no reviews)
2012/08/16 20:53:52
Done.
| |
| 82 void DisconnectFromDaemon(); | |
| 83 | |
| 68 const scoped_refptr<net::URLRequestContextGetter>& | 84 const scoped_refptr<net::URLRequestContextGetter>& |
| 69 url_request_context_getter(); | 85 url_request_context_getter(); |
| 70 | 86 |
| 71 private: | 87 private: |
| 72 FRIEND_TEST_ALL_PREFIXES(ChromotingHostContextTest, StartAndStop); | 88 FRIEND_TEST_ALL_PREFIXES(ChromotingHostContextTest, StartAndStop); |
| 73 | 89 |
| 74 // A thread that hosts all network operations. | 90 // A thread that hosts all network operations. |
| 75 base::Thread network_thread_; | 91 base::Thread network_thread_; |
| 76 | 92 |
| 77 // A thread that hosts screen capture. | 93 // A thread that hosts screen capture. |
| 78 base::Thread capture_thread_; | 94 base::Thread capture_thread_; |
| 79 | 95 |
| 80 // A thread that hosts all encode operations. | 96 // A thread that hosts all encode operations. |
| 81 base::Thread encode_thread_; | 97 base::Thread encode_thread_; |
| 82 | 98 |
| 83 // A thread that hosts input injection. | 99 // A thread that hosts input injection. |
| 84 base::Thread desktop_thread_; | 100 base::Thread desktop_thread_; |
| 85 | 101 |
| 86 // Thread for blocking IO operations. | 102 // Thread for blocking IO operations. |
| 87 base::Thread file_thread_; | 103 base::Thread file_thread_; |
| 88 | 104 |
| 105 // The IPC channel connection us to the daemon process. | |
|
simonmorris
2012/08/16 20:43:02
"connection" -> "connecting"
alexeypa (please no reviews)
2012/08/16 20:53:52
Done.
| |
| 106 scoped_ptr<IPC::ChannelProxy> daemon_channel_; | |
| 107 | |
| 89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 108 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 90 | 109 |
| 91 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 110 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| 92 | 111 |
| 93 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 112 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); |
| 94 }; | 113 }; |
| 95 | 114 |
| 96 } // namespace remoting | 115 } // namespace remoting |
| 97 | 116 |
| 98 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 117 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ |
| OLD | NEW |