| 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 #include "remoting/host/chromoting_host_context.h" | 5 #include "remoting/host/chromoting_host_context.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 ui_task_runner_ = NULL; | 38 ui_task_runner_ = NULL; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool ChromotingHostContext::Start() { | 41 bool ChromotingHostContext::Start() { |
| 42 // Start all the threads. | 42 // Start all the threads. |
| 43 bool started = capture_thread_.Start() && encode_thread_.Start() && | 43 bool started = capture_thread_.Start() && encode_thread_.Start() && |
| 44 audio_thread_.StartWithOptions(base::Thread::Options( | 44 audio_thread_.StartWithOptions(base::Thread::Options( |
| 45 MessageLoop::TYPE_IO, 0)) && | 45 MessageLoop::TYPE_IO, 0)) && |
| 46 network_thread_.StartWithOptions(base::Thread::Options( | 46 network_thread_.StartWithOptions(base::Thread::Options( |
| 47 MessageLoop::TYPE_IO, 0)) && | 47 MessageLoop::TYPE_IO, 0)) && |
| 48 desktop_thread_.Start() && | 48 desktop_thread_.StartWithOptions(base::Thread::Options( |
| 49 MessageLoop::TYPE_IO, 0)) && |
| 49 file_thread_.StartWithOptions( | 50 file_thread_.StartWithOptions( |
| 50 base::Thread::Options(MessageLoop::TYPE_IO, 0)); | 51 base::Thread::Options(MessageLoop::TYPE_IO, 0)); |
| 51 if (!started) | 52 if (!started) |
| 52 return false; | 53 return false; |
| 53 | 54 |
| 54 // Wrap worker threads with |AutoThreadTaskRunner| and have them reference | 55 // Wrap worker threads with |AutoThreadTaskRunner| and have them reference |
| 55 // the main thread via |ui_task_runner_|, to ensure that it remain active to | 56 // the main thread via |ui_task_runner_|, to ensure that it remain active to |
| 56 // Stop() them when no references remain. | 57 // Stop() them when no references remain. |
| 57 audio_task_runner_ = | 58 audio_task_runner_ = |
| 58 new AutoThreadTaskRunner(audio_thread_.message_loop_proxy(), | 59 new AutoThreadTaskRunner(audio_thread_.message_loop_proxy(), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return ui_task_runner_; | 108 return ui_task_runner_; |
| 108 } | 109 } |
| 109 | 110 |
| 110 const scoped_refptr<net::URLRequestContextGetter>& | 111 const scoped_refptr<net::URLRequestContextGetter>& |
| 111 ChromotingHostContext::url_request_context_getter() { | 112 ChromotingHostContext::url_request_context_getter() { |
| 112 DCHECK(url_request_context_getter_.get()); | 113 DCHECK(url_request_context_getter_.get()); |
| 113 return url_request_context_getter_; | 114 return url_request_context_getter_; |
| 114 } | 115 } |
| 115 | 116 |
| 116 } // namespace remoting | 117 } // namespace remoting |
| OLD | NEW |