OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/html_viewer/web_layer_tree_view_impl.h" | 5 #include "components/html_viewer/web_layer_tree_view_impl.h" |
6 | 6 |
7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/blink/web_layer_impl.h" | 8 #include "cc/blink/web_layer_impl.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/output/begin_frame_args.h" | 10 #include "cc/output/begin_frame_args.h" |
11 #include "cc/scheduler/begin_frame_source.h" | 11 #include "cc/scheduler/begin_frame_source.h" |
12 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
13 #include "components/view_manager/public/cpp/view.h" | 13 #include "components/view_manager/public/cpp/view.h" |
14 #include "mojo/cc/context_provider_mojo.h" | 14 #include "mojo/cc/context_provider_mojo.h" |
15 #include "mojo/cc/output_surface_mojo.h" | 15 #include "mojo/cc/output_surface_mojo.h" |
16 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 16 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
17 #include "third_party/WebKit/public/web/WebWidget.h" | 17 #include "third_party/WebKit/public/web/WebWidget.h" |
18 | 18 |
19 namespace html_viewer { | 19 namespace html_viewer { |
20 | 20 |
21 WebLayerTreeViewImpl::WebLayerTreeViewImpl( | 21 WebLayerTreeViewImpl::WebLayerTreeViewImpl( |
22 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy, | 22 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy, |
23 mojo::SurfacePtr surface, | 23 mojo::SurfacePtr surface, |
24 mojo::GpuPtr gpu_service) | 24 mojo::GpuPtr gpu_service) |
25 : widget_(NULL), | 25 : widget_(NULL), |
26 view_(NULL), | 26 view_(NULL), |
27 main_thread_compositor_task_runner_(base::MessageLoopProxy::current()), | 27 main_thread_compositor_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
28 weak_factory_(this) { | 28 weak_factory_(this) { |
29 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr(); | 29 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr(); |
30 | 30 |
31 cc::LayerTreeSettings settings; | 31 cc::LayerTreeSettings settings; |
32 | 32 |
33 // For web contents, layer transforms should scale up the contents of layers | 33 // For web contents, layer transforms should scale up the contents of layers |
34 // to keep content always crisp when possible. | 34 // to keep content always crisp when possible. |
35 settings.layer_transforms_should_scale_layer_contents = true; | 35 settings.layer_transforms_should_scale_layer_contents = true; |
36 | 36 |
37 cc::SharedBitmapManager* shared_bitmap_manager = nullptr; | 37 cc::SharedBitmapManager* shared_bitmap_manager = nullptr; |
38 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; | 38 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; |
39 cc::TaskGraphRunner* task_graph_runner = nullptr; | 39 cc::TaskGraphRunner* task_graph_runner = nullptr; |
40 | 40 |
41 cc::LayerTreeHost::InitParams params; | |
42 params.client = this; | |
43 params.shared_bitmap_manager = shared_bitmap_manager; | |
danakj
2015/05/07 00:59:56
you're not using the settings here, can you double
sadrul
2015/05/07 04:39:26
Fixed. (the default set of trybots didn't catch th
| |
44 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; | |
45 params.task_graph_runner = task_graph_runner; | |
46 params.main_task_runner = main_thread_compositor_task_runner_; | |
47 params.external_begin_frame_source = external_begin_frame_source.Pass(); | |
48 | |
41 layer_tree_host_ = | 49 layer_tree_host_ = |
42 cc::LayerTreeHost::CreateThreaded(this, | 50 cc::LayerTreeHost::CreateThreaded(compositor_message_loop_proxy, ¶ms); |
43 shared_bitmap_manager, | |
44 gpu_memory_buffer_manager, | |
45 task_graph_runner, | |
46 settings, | |
47 base::MessageLoopProxy::current(), | |
48 compositor_message_loop_proxy, | |
49 nullptr); | |
50 DCHECK(layer_tree_host_); | 51 DCHECK(layer_tree_host_); |
51 | 52 |
52 if (surface && gpu_service) { | 53 if (surface && gpu_service) { |
53 mojo::CommandBufferPtr cb; | 54 mojo::CommandBufferPtr cb; |
54 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); | 55 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); |
55 scoped_refptr<cc::ContextProvider> context_provider( | 56 scoped_refptr<cc::ContextProvider> context_provider( |
56 new mojo::ContextProviderMojo(cb.PassMessagePipe())); | 57 new mojo::ContextProviderMojo(cb.PassMessagePipe())); |
57 output_surface_.reset( | 58 output_surface_.reset( |
58 new mojo::OutputSurfaceMojo(this, context_provider, surface.Pass())); | 59 new mojo::OutputSurfaceMojo(this, context_provider, surface.Pass())); |
59 } | 60 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, | 246 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, |
246 main_thread_bound_weak_ptr_, | 247 main_thread_bound_weak_ptr_, |
247 id)); | 248 id)); |
248 } | 249 } |
249 | 250 |
250 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { | 251 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { |
251 view_->SetSurfaceId(mojo::SurfaceId::From(id)); | 252 view_->SetSurfaceId(mojo::SurfaceId::From(id)); |
252 } | 253 } |
253 | 254 |
254 } // namespace html_viewer | 255 } // namespace html_viewer |
OLD | NEW |