| 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 #include "blimp/client/core/blimp_client_context_impl.h" | 5 #include "blimp/client/core/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/sequenced_task_runner_handle.h" | 12 #include "base/threading/sequenced_task_runner_handle.h" |
| 13 #include "blimp/client/core/blimp_client_switches.h" |
| 11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 14 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 12 #include "blimp/client/core/contents/blimp_contents_manager.h" | 15 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 13 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 16 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| 14 #include "blimp/client/public/blimp_client_context_delegate.h" | 17 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 15 | 18 |
| 16 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
| 17 #include "blimp/client/core/android/blimp_client_context_impl_android.h" | 20 #include "blimp/client/core/android/blimp_client_context_impl_android.h" |
| 18 #endif // OS_ANDROID | 21 #endif // OS_ANDROID |
| 19 | 22 |
| 20 namespace blimp { | 23 namespace blimp { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) { | 38 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) { |
| 36 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
| 37 return new BlimpClientContextImplAndroid(io_thread_task_runner, | 40 return new BlimpClientContextImplAndroid(io_thread_task_runner, |
| 38 file_thread_task_runner); | 41 file_thread_task_runner); |
| 39 #else | 42 #else |
| 40 return new BlimpClientContextImpl(io_thread_task_runner, | 43 return new BlimpClientContextImpl(io_thread_task_runner, |
| 41 file_thread_task_runner); | 44 file_thread_task_runner); |
| 42 #endif // defined(OS_ANDROID) | 45 #endif // defined(OS_ANDROID) |
| 43 } | 46 } |
| 44 | 47 |
| 48 // static |
| 49 void BlimpClientContext::Initialize() { |
| 50 CompositorDepsProvider::Initialize( |
| 51 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 52 switches::kUseInternalDisplay)); |
| 53 } |
| 54 |
| 55 // static |
| 56 void BlimpClientContext::Terminate() { |
| 57 CompositorDepsProvider::Terminate(); |
| 58 } |
| 59 |
| 45 BlimpClientContextImpl::BlimpClientContextImpl( | 60 BlimpClientContextImpl::BlimpClientContextImpl( |
| 46 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 61 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 47 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) | 62 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) |
| 48 : BlimpClientContext(), | 63 : BlimpClientContext(), |
| 49 io_thread_task_runner_(io_thread_task_runner), | 64 io_thread_task_runner_(io_thread_task_runner), |
| 50 file_thread_task_runner_(file_thread_task_runner), | 65 file_thread_task_runner_(file_thread_task_runner), |
| 51 blimp_contents_manager_(new BlimpContentsManager), | 66 render_widget_feature_(base::MakeUnique<RenderWidgetFeature>()), |
| 67 blimp_contents_manager_( |
| 68 new BlimpContentsManager(render_widget_feature_.get())), |
| 52 weak_factory_(this) { | 69 weak_factory_(this) { |
| 53 net_components_.reset(new ClientNetworkComponents( | 70 net_components_.reset(new ClientNetworkComponents( |
| 54 base::MakeUnique<CrossThreadNetworkEventObserver>( | 71 base::MakeUnique<CrossThreadNetworkEventObserver>( |
| 55 weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get()))); | 72 weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get()))); |
| 56 | 73 |
| 57 // The |thread_pipe_manager_| must be set up correctly before features are | 74 // The |thread_pipe_manager_| must be set up correctly before features are |
| 58 // registered. | 75 // registered. |
| 59 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( | 76 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( |
| 60 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); | 77 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); |
| 61 | 78 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 134 } |
| 118 | 135 |
| 119 io_thread_task_runner_->PostTask( | 136 io_thread_task_runner_->PostTask( |
| 120 FROM_HERE, | 137 FROM_HERE, |
| 121 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 138 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
| 122 base::Unretained(net_components_.get()), assignment)); | 139 base::Unretained(net_components_.get()), assignment)); |
| 123 } | 140 } |
| 124 | 141 |
| 125 } // namespace client | 142 } // namespace client |
| 126 } // namespace blimp | 143 } // namespace blimp |
| OLD | NEW |