OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ | 5 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ |
6 #define REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ | 6 #define REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
11 #include "remoting/base/auto_thread.h" | 12 #include "remoting/base/auto_thread.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class MessageLoopForUI; | 15 class MessageLoopForUI; |
15 } // namespace base | 16 } // namespace base |
16 | 17 |
17 // Houses the global resources on which the Chromoting components run | 18 // Houses the global resources on which the Chromoting components run |
18 // (e.g. message loops and task runners). | 19 // (e.g. message loops and task runners). |
19 namespace remoting { | 20 namespace remoting { |
20 | 21 |
21 class ChromotingClientRuntime { | 22 class ChromotingClientRuntime { |
22 public: | 23 public: |
23 // Caller to create is responsible for creating and attaching a new ui thread | 24 // Caller to create is responsible for creating and attaching a new ui thread |
24 // for use. Example: | 25 // for use. Example: |
25 // | 26 // |
26 // On Android, the UI thread is managed by Java, so we need to attach and | 27 // On Android, the UI thread is managed by Java, so we need to attach and |
27 // start a special type of message loop to allow Chromium code to run tasks. | 28 // start a special type of message loop to allow Chromium code to run tasks. |
28 // | 29 // |
29 // base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI(); | 30 // base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI(); |
30 // ui_loop_->Start(); | 31 // ui_loop_->Start(); |
31 // scoped_ptr<ChromotingClientRuntime> runtime = | 32 // std::unique_ptr<ChromotingClientRuntime> runtime = |
32 // ChromotingClientRuntime::Create(ui_loop); | 33 // ChromotingClientRuntime::Create(ui_loop); |
33 // | 34 // |
34 // On iOS we created a new message loop and now attach it. | 35 // On iOS we created a new message loop and now attach it. |
35 // | 36 // |
36 // base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI(); | 37 // base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI(); |
37 // ui_loop_->Attach(); | 38 // ui_loop_->Attach(); |
38 // scoped_ptr<ChromotingClientRuntime> runtime = | 39 // std::unique_ptr<ChromotingClientRuntime> runtime = |
39 // ChromotingClientRuntime::Create(ui_loop); | 40 // ChromotingClientRuntime::Create(ui_loop); |
40 // | 41 // |
41 static scoped_ptr<ChromotingClientRuntime> Create( | 42 static std::unique_ptr<ChromotingClientRuntime> Create( |
42 base::MessageLoopForUI* ui_loop); | 43 base::MessageLoopForUI* ui_loop); |
43 | 44 |
44 ~ChromotingClientRuntime(); | 45 ~ChromotingClientRuntime(); |
45 | 46 |
46 scoped_refptr<AutoThreadTaskRunner> network_task_runner() { | 47 scoped_refptr<AutoThreadTaskRunner> network_task_runner() { |
47 return network_task_runner_; | 48 return network_task_runner_; |
48 } | 49 } |
49 | 50 |
50 scoped_refptr<AutoThreadTaskRunner> ui_task_runner() { | 51 scoped_refptr<AutoThreadTaskRunner> ui_task_runner() { |
51 return ui_task_runner_; | 52 return ui_task_runner_; |
(...skipping 28 matching lines...) Expand all Loading... |
80 scoped_refptr<AutoThreadTaskRunner> file_task_runner_; | 81 scoped_refptr<AutoThreadTaskRunner> file_task_runner_; |
81 | 82 |
82 scoped_refptr<net::URLRequestContextGetter> url_requester_; | 83 scoped_refptr<net::URLRequestContextGetter> url_requester_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime); | 85 DISALLOW_COPY_AND_ASSIGN(ChromotingClientRuntime); |
85 }; | 86 }; |
86 | 87 |
87 } // namespace remoting | 88 } // namespace remoting |
88 | 89 |
89 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ | 90 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_ |
OLD | NEW |