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 19 matching lines...) Expand all Loading... |
30 // Start all the threads. | 30 // Start all the threads. |
31 bool started = main_thread_.Start() && encode_thread_.Start() && | 31 bool started = main_thread_.Start() && encode_thread_.Start() && |
32 jingle_thread_.Start() && desktop_thread_.Start() && | 32 jingle_thread_.Start() && desktop_thread_.Start() && |
33 io_thread_.StartWithOptions( | 33 io_thread_.StartWithOptions( |
34 base::Thread::Options(MessageLoop::TYPE_IO, 0)) && | 34 base::Thread::Options(MessageLoop::TYPE_IO, 0)) && |
35 file_thread_.StartWithOptions( | 35 file_thread_.StartWithOptions( |
36 base::Thread::Options(MessageLoop::TYPE_IO, 0)); | 36 base::Thread::Options(MessageLoop::TYPE_IO, 0)); |
37 if (!started) | 37 if (!started) |
38 return false; | 38 return false; |
39 | 39 |
40 // net::ProxyService::CreateSystemProxyConfigService requires a UI thread. | 40 url_request_context_getter_ = new URLRequestContextGetter( |
41 // TODO(jamiewalch): Clean up this dependency. | 41 ui_message_loop_, io_thread_.message_loop(), |
42 MessageLoop* loop = MessageLoop::current(); | 42 static_cast<MessageLoopForIO*>(file_thread_.message_loop())); |
43 if (loop && loop->type() == MessageLoop::TYPE_UI) { | |
44 url_request_context_getter_ = new URLRequestContextGetter( | |
45 io_thread_.message_loop(), file_thread_.message_loop()); | |
46 } | |
47 return true; | 43 return true; |
48 } | 44 } |
49 | 45 |
50 JingleThread* ChromotingHostContext::jingle_thread() { | 46 JingleThread* ChromotingHostContext::jingle_thread() { |
51 return &jingle_thread_; | 47 return &jingle_thread_; |
52 } | 48 } |
53 | 49 |
54 MessageLoop* ChromotingHostContext::main_message_loop() { | 50 MessageLoop* ChromotingHostContext::main_message_loop() { |
55 return main_thread_.message_loop(); | 51 return main_thread_.message_loop(); |
56 } | 52 } |
(...skipping 22 matching lines...) Expand all Loading... |
79 return file_thread_.message_loop_proxy(); | 75 return file_thread_.message_loop_proxy(); |
80 } | 76 } |
81 | 77 |
82 const scoped_refptr<URLRequestContextGetter>& | 78 const scoped_refptr<URLRequestContextGetter>& |
83 ChromotingHostContext::url_request_context_getter() { | 79 ChromotingHostContext::url_request_context_getter() { |
84 DCHECK(url_request_context_getter_.get()); | 80 DCHECK(url_request_context_getter_.get()); |
85 return url_request_context_getter_; | 81 return url_request_context_getter_; |
86 } | 82 } |
87 | 83 |
88 } // namespace remoting | 84 } // namespace remoting |
OLD | NEW |