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> | |
| 9 | |
| 10 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" | 
| 11 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" | 
| 12 #include "base/threading/platform_thread.h" | 10 #include "base/single_thread_task_runner.h" | 
| 13 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" | 
| 14 | 12 | 
| 15 namespace base { | |
| 16 class SingleThreadTaskRunner; | |
| 17 } // namespace base | |
| 18 | |
| 19 namespace net { | 13 namespace net { | 
| 20 class URLRequestContextGetter; | 14 class URLRequestContextGetter; | 
| 21 } // namespace net | 15 } // namespace net | 
| 22 | 16 | 
| 23 namespace remoting { | 17 namespace remoting { | 
| 24 | 18 | 
| 25 // A class that manages threads and running context for the chromoting host | 19 // A class that manages threads and running context for the chromoting host | 
| 26 // process. This class is virtual only for testing purposes (see below). | 20 // process. This class is virtual only for testing purposes (see below). | 
| 27 class ChromotingHostContext { | 21 class ChromotingHostContext { | 
| 28 public: | 22 public: | 
| 29 // Create a context. | 23 // Create a context. | 
| 30 ChromotingHostContext( | 24 ChromotingHostContext(base::SingleThreadTaskRunner* ui_task_runner); | 
| 
 
Wez
2012/08/30 18:25:41
This should remain scoped_refptr<> to implicitly d
 
 | |
| 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | |
| 32 virtual ~ChromotingHostContext(); | 25 virtual ~ChromotingHostContext(); | 
| 33 | 26 | 
| 34 // TODO(ajwong): Move the Start method out of this class. Then | 27 // TODO(ajwong): Move the Start method out of this class. Then | 
| 35 // create a static factory for construction, and destruction. We | 28 // create a static factory for construction, and destruction. We | 
| 36 // should be able to remove the need for virtual functions below | 29 // should be able to remove the need for virtual functions below | 
| 37 // with that design, while preserving the relative simplicity of | 30 // with that design, while preserving the relative simplicity of | 
| 38 // this API. | 31 // this API. | 
| 39 virtual bool Start(); | 32 virtual bool Start(); | 
| 40 | 33 | 
| 41 // Task runner for the thread that is used for the UI. In the NPAPI | 34 // Task runner for the thread that is used for the UI. In the NPAPI | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 | 72 | 
| 80 // A thread that hosts all encode operations. | 73 // A thread that hosts all encode operations. | 
| 81 base::Thread encode_thread_; | 74 base::Thread encode_thread_; | 
| 82 | 75 | 
| 83 // A thread that hosts input injection. | 76 // A thread that hosts input injection. | 
| 84 base::Thread desktop_thread_; | 77 base::Thread desktop_thread_; | 
| 85 | 78 | 
| 86 // Thread for blocking IO operations. | 79 // Thread for blocking IO operations. | 
| 87 base::Thread file_thread_; | 80 base::Thread file_thread_; | 
| 88 | 81 | 
| 82 // Task runners wrapping the above threads. These should be declared after | |
| 83 // the corresponding threads to guarantee proper order of destruction. | |
| 84 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | |
| 85 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | |
| 86 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; | |
| 87 scoped_refptr<base::SingleThreadTaskRunner> desktop_task_runner_; | |
| 88 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | |
| 89 | |
| 89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 
| 90 | 91 | 
| 91 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 92 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 
| 92 | 93 | 
| 93 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 94 DISALLOW_COPY_AND_ASSIGN(ChromotingHostContext); | 
| 94 }; | 95 }; | 
| 95 | 96 | 
| 96 } // namespace remoting | 97 } // namespace remoting | 
| 97 | 98 | 
| 98 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 99 #endif // REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_ | 
| OLD | NEW |