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/lazy_instance.h" | |
8 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/sequenced_task_runner_handle.h" | 11 #include "base/threading/sequenced_task_runner_handle.h" |
11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 12 #include "blimp/client/core/contents/blimp_contents_impl.h" |
12 #include "blimp/client/core/contents/blimp_contents_manager.h" | 13 #include "blimp/client/core/contents/blimp_contents_manager.h" |
13 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 14 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
14 #include "blimp/client/public/blimp_client_context_delegate.h" | 15 #include "blimp/client/public/blimp_client_context_delegate.h" |
15 | 16 |
16 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
17 #include "blimp/client/core/android/blimp_client_context_impl_android.h" | 18 #include "blimp/client/core/android/blimp_client_context_impl_android.h" |
18 #endif // OS_ANDROID | 19 #endif // OS_ANDROID |
19 | 20 |
20 namespace blimp { | 21 namespace blimp { |
21 namespace client { | 22 namespace client { |
22 | 23 |
23 namespace { | 24 namespace { |
24 const char kDefaultAssignerUrl[] = | 25 const char kDefaultAssignerUrl[] = |
25 "https://blimp-pa.googleapis.com/v1/assignment"; | 26 "https://blimp-pa.googleapis.com/v1/assignment"; |
27 | |
28 // This should go elsewhere when we start setting up the feature code. | |
29 base::LazyInstance<RenderWidgetFeature> g_render_widget_feature; | |
nyquist
2016/08/16 23:14:57
Discussed with dtrainor@. I think for now BlimpCli
Khushal
2016/08/18 03:16:32
Makes sense. Done.
That is where we do start up th
| |
26 } // namespace | 30 } // namespace |
27 | 31 |
28 // This function is declared in //blimp/client/public/blimp_client_context.h, | 32 // This function is declared in //blimp/client/public/blimp_client_context.h, |
29 // and either this function or the one in | 33 // and either this function or the one in |
30 // //blimp/client/core/dummy_blimp_client_context.cc should be linked in to | 34 // //blimp/client/core/dummy_blimp_client_context.cc should be linked in to |
31 // any binary using BlimpClientContext::Create. | 35 // any binary using BlimpClientContext::Create. |
32 // static | 36 // static |
33 BlimpClientContext* BlimpClientContext::Create( | 37 BlimpClientContext* BlimpClientContext::Create( |
34 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 38 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
35 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) { | 39 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) { |
36 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
37 return new BlimpClientContextImplAndroid(io_thread_task_runner, | 41 return new BlimpClientContextImplAndroid(io_thread_task_runner, |
38 file_thread_task_runner); | 42 file_thread_task_runner); |
39 #else | 43 #else |
40 return new BlimpClientContextImpl(io_thread_task_runner, | 44 return new BlimpClientContextImpl(io_thread_task_runner, |
41 file_thread_task_runner); | 45 file_thread_task_runner); |
42 #endif // defined(OS_ANDROID) | 46 #endif // defined(OS_ANDROID) |
43 } | 47 } |
44 | 48 |
45 BlimpClientContextImpl::BlimpClientContextImpl( | 49 BlimpClientContextImpl::BlimpClientContextImpl( |
46 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 50 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
47 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) | 51 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner) |
48 : BlimpClientContext(), | 52 : BlimpClientContext(), |
49 io_thread_task_runner_(io_thread_task_runner), | 53 io_thread_task_runner_(io_thread_task_runner), |
50 file_thread_task_runner_(file_thread_task_runner), | 54 file_thread_task_runner_(file_thread_task_runner), |
51 blimp_contents_manager_(new BlimpContentsManager), | 55 blimp_contents_manager_( |
56 new BlimpContentsManager(true, g_render_widget_feature.Pointer())), | |
52 weak_factory_(this) { | 57 weak_factory_(this) { |
53 net_components_.reset(new ClientNetworkComponents( | 58 net_components_.reset(new ClientNetworkComponents( |
54 base::MakeUnique<CrossThreadNetworkEventObserver>( | 59 base::MakeUnique<CrossThreadNetworkEventObserver>( |
55 weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get()))); | 60 weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get()))); |
56 | 61 |
57 // The |thread_pipe_manager_| must be set up correctly before features are | 62 // The |thread_pipe_manager_| must be set up correctly before features are |
58 // registered. | 63 // registered. |
59 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( | 64 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( |
60 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); | 65 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); |
61 | 66 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 } | 122 } |
118 | 123 |
119 io_thread_task_runner_->PostTask( | 124 io_thread_task_runner_->PostTask( |
120 FROM_HERE, | 125 FROM_HERE, |
121 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 126 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
122 base::Unretained(net_components_.get()), assignment)); | 127 base::Unretained(net_components_.get()), assignment)); |
123 } | 128 } |
124 | 129 |
125 } // namespace client | 130 } // namespace client |
126 } // namespace blimp | 131 } // namespace blimp |
OLD | NEW |