| 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/thread_task_runner_handle.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 #include "ui/gfx/buffer_types.h" |
| 18 | 19 |
| 19 namespace html_viewer { | 20 namespace html_viewer { |
| 20 | 21 |
| 21 WebLayerTreeViewImpl::WebLayerTreeViewImpl( | 22 WebLayerTreeViewImpl::WebLayerTreeViewImpl( |
| 22 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, | 23 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, |
| 23 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 24 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 24 cc::TaskGraphRunner* task_graph_runner, | 25 cc::TaskGraphRunner* task_graph_runner, |
| 25 mojo::SurfacePtr surface, | 26 mojo::SurfacePtr surface, |
| 26 mojo::GpuPtr gpu_service) | 27 mojo::GpuPtr gpu_service) |
| 27 : widget_(NULL), | 28 : widget_(NULL), |
| 28 view_(NULL), | 29 view_(NULL), |
| 29 main_thread_compositor_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 30 main_thread_compositor_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 30 weak_factory_(this) { | 31 weak_factory_(this) { |
| 31 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr(); | 32 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 32 | 33 |
| 33 cc::LayerTreeSettings settings; | 34 cc::LayerTreeSettings settings; |
| 34 | 35 |
| 35 // Must match the value of | 36 // Must match the value of |
| 36 // blink::RuntimeEnabledFeature::slimmingPaintEnabled() | 37 // blink::RuntimeEnabledFeature::slimmingPaintEnabled() |
| 37 settings.use_display_lists = true; | 38 settings.use_display_lists = true; |
| 38 | 39 |
| 39 settings.use_image_texture_target = GL_TEXTURE_2D; | 40 settings.use_image_texture_targets = std::vector<unsigned>( |
| 41 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D); |
| 40 settings.use_one_copy = true; | 42 settings.use_one_copy = true; |
| 41 // TODO(jam): use multiple compositor raster threads and set gather_pixel_refs | 43 // TODO(jam): use multiple compositor raster threads and set gather_pixel_refs |
| 42 // accordingly (see content). | 44 // accordingly (see content). |
| 43 | 45 |
| 44 // For web contents, layer transforms should scale up the contents of layers | 46 // For web contents, layer transforms should scale up the contents of layers |
| 45 // to keep content always crisp when possible. | 47 // to keep content always crisp when possible. |
| 46 settings.layer_transforms_should_scale_layer_contents = true; | 48 settings.layer_transforms_should_scale_layer_contents = true; |
| 47 | 49 |
| 48 cc::SharedBitmapManager* shared_bitmap_manager = nullptr; | 50 cc::SharedBitmapManager* shared_bitmap_manager = nullptr; |
| 49 | 51 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, | 249 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread, |
| 248 main_thread_bound_weak_ptr_, | 250 main_thread_bound_weak_ptr_, |
| 249 id)); | 251 id)); |
| 250 } | 252 } |
| 251 | 253 |
| 252 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { | 254 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) { |
| 253 view_->SetSurfaceId(mojo::SurfaceId::From(id)); | 255 view_->SetSurfaceId(mojo::SurfaceId::From(id)); |
| 254 } | 256 } |
| 255 | 257 |
| 256 } // namespace html_viewer | 258 } // namespace html_viewer |
| OLD | NEW |