Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: components/html_viewer/web_layer_tree_view_impl.cc

Issue 1281663002: Mandoline: Allow submitting CompositorFrames directly to mojo::Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/html_viewer/web_layer_tree_view_impl.h ('k') | components/pdf_viewer/pdf_viewer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/gfx/buffer_types.h"
19 19
20 namespace html_viewer { 20 namespace html_viewer {
21 21
22 WebLayerTreeViewImpl::WebLayerTreeViewImpl( 22 WebLayerTreeViewImpl::WebLayerTreeViewImpl(
23 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, 23 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
24 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 24 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
25 cc::TaskGraphRunner* task_graph_runner, 25 cc::TaskGraphRunner* task_graph_runner)
26 mojo::SurfacePtr surface,
27 mojo::GpuPtr gpu_service)
28 : widget_(NULL), 26 : widget_(NULL),
29 view_(NULL), 27 view_(NULL),
30 main_thread_compositor_task_runner_(base::ThreadTaskRunnerHandle::Get()), 28 main_thread_compositor_task_runner_(base::ThreadTaskRunnerHandle::Get()),
31 weak_factory_(this) { 29 weak_factory_(this) {
32 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr(); 30 main_thread_bound_weak_ptr_ = weak_factory_.GetWeakPtr();
33 31
34 cc::LayerTreeSettings settings; 32 cc::LayerTreeSettings settings;
35 33
36 // Must match the value of 34 // Must match the value of
37 // blink::RuntimeEnabledFeature::slimmingPaintEnabled() 35 // blink::RuntimeEnabledFeature::slimmingPaintEnabled()
(...skipping 16 matching lines...) Expand all
54 params.client = this; 52 params.client = this;
55 params.shared_bitmap_manager = shared_bitmap_manager; 53 params.shared_bitmap_manager = shared_bitmap_manager;
56 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager; 54 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
57 params.settings = &settings; 55 params.settings = &settings;
58 params.task_graph_runner = task_graph_runner; 56 params.task_graph_runner = task_graph_runner;
59 params.main_task_runner = main_thread_compositor_task_runner_; 57 params.main_task_runner = main_thread_compositor_task_runner_;
60 58
61 layer_tree_host_ = 59 layer_tree_host_ =
62 cc::LayerTreeHost::CreateThreaded(compositor_task_runner, &params); 60 cc::LayerTreeHost::CreateThreaded(compositor_task_runner, &params);
63 DCHECK(layer_tree_host_); 61 DCHECK(layer_tree_host_);
62 }
64 63
65 if (surface && gpu_service) { 64 void WebLayerTreeViewImpl::Initialize(mojo::GpuPtr gpu_service,
65 mojo::View* view,
66 blink::WebWidget* widget) {
67 view_ = view;
68 widget_ = widget;
69 if (gpu_service) {
66 mojo::CommandBufferPtr cb; 70 mojo::CommandBufferPtr cb;
67 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb)); 71 gpu_service->CreateOffscreenGLES2Context(GetProxy(&cb));
68 scoped_refptr<cc::ContextProvider> context_provider( 72 scoped_refptr<cc::ContextProvider> context_provider(
69 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle())); 73 new mojo::ContextProviderMojo(cb.PassInterface().PassHandle()));
70 output_surface_.reset( 74 output_surface_.reset(
71 new mojo::OutputSurfaceMojo(this, context_provider, 75 new mojo::OutputSurfaceMojo(context_provider, view_->RequestSurface()));
72 surface.PassInterface().PassHandle()));
73 } 76 }
74 layer_tree_host_->SetLayerTreeHostClientReady(); 77 layer_tree_host_->SetLayerTreeHostClientReady();
75 } 78 }
76 79
77 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { 80 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() {
78 // Destroy the LayerTreeHost before anything else as doing so ensures we're 81 // Destroy the LayerTreeHost before anything else as doing so ensures we're
79 // not accessed on the compositor thread (we are the LayerTreeHostClient). 82 // not accessed on the compositor thread (we are the LayerTreeHostClient).
80 layer_tree_host_.reset(); 83 layer_tree_host_.reset();
81 } 84 }
82 85
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 242 }
240 243
241 void WebLayerTreeViewImpl::setNeedsAnimate() { 244 void WebLayerTreeViewImpl::setNeedsAnimate() {
242 layer_tree_host_->SetNeedsAnimate(); 245 layer_tree_host_->SetNeedsAnimate();
243 } 246 }
244 247
245 void WebLayerTreeViewImpl::finishAllRendering() { 248 void WebLayerTreeViewImpl::finishAllRendering() {
246 layer_tree_host_->FinishAllRendering(); 249 layer_tree_host_->FinishAllRendering();
247 } 250 }
248 251
249 void WebLayerTreeViewImpl::DidCreateSurface(cc::SurfaceId id) {
250 main_thread_compositor_task_runner_->PostTask(
251 FROM_HERE,
252 base::Bind(&WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread,
253 main_thread_bound_weak_ptr_,
254 id));
255 }
256
257 void WebLayerTreeViewImpl::DidCreateSurfaceOnMainThread(cc::SurfaceId id) {
258 view_->SetSurfaceId(mojo::SurfaceId::From(id));
259 }
260
261 } // namespace html_viewer 252 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/web_layer_tree_view_impl.h ('k') | components/pdf_viewer/pdf_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698