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

Side by Side Diff: content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.cc

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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
OLDNEW
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 "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.h " 5 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.h "
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_manager.h" 8 #include "cc/surfaces/surface_manager.h"
9 #include "content/browser/compositor/surface_utils.h" 9 #include "content/browser/compositor/surface_utils.h"
10 #include "mojo/public/cpp/bindings/strong_binding.h" 10 #include "mojo/public/cpp/bindings/strong_binding.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 OffscreenCanvasCompositorFrameSink::OffscreenCanvasCompositorFrameSink( 14 OffscreenCanvasCompositorFrameSink::OffscreenCanvasCompositorFrameSink(
15 const cc::SurfaceId& surface_id, 15 const cc::SurfaceId& surface_id,
16 cc::mojom::MojoCompositorFrameSinkClientPtr client) 16 cc::mojom::MojoCompositorFrameSinkClientPtr client)
17 : surface_id_(surface_id), client_(std::move(client)) {} 17 : surface_id_(surface_id), client_(std::move(client)) {}
18 18
19 OffscreenCanvasCompositorFrameSink::~OffscreenCanvasCompositorFrameSink() { 19 OffscreenCanvasCompositorFrameSink::~OffscreenCanvasCompositorFrameSink() {
20 if (surface_factory_) { 20 if (surface_factory_) {
21 cc::SurfaceManager* manager = GetSurfaceManager(); 21 cc::SurfaceManager* manager = GetSurfaceManager();
22 if (!manager) { 22 if (!manager) {
23 // Inform SurfaceFactory that SurfaceManager's no longer alive to 23 // Inform SurfaceFactory that SurfaceManager's no longer alive to
24 // avoid its destruction error. 24 // avoid its destruction error.
25 surface_factory_->DidDestroySurfaceManager(); 25 surface_factory_->DidDestroySurfaceManager();
26 } else { 26 } else {
27 manager->InvalidateFrameSinkId(surface_id_.frame_sink_id()); 27 manager->InvalidateFrameSinkId(surface_id_.frame_sink_id());
28 } 28 }
29 surface_factory_->Destroy(surface_id_); 29 surface_factory_->Destroy(surface_id_.local_frame_id());
30 } 30 }
31 } 31 }
32 32
33 // static 33 // static
34 void OffscreenCanvasCompositorFrameSink::Create( 34 void OffscreenCanvasCompositorFrameSink::Create(
35 const cc::SurfaceId& surface_id, 35 const cc::SurfaceId& surface_id,
36 cc::mojom::MojoCompositorFrameSinkClientPtr client, 36 cc::mojom::MojoCompositorFrameSinkClientPtr client,
37 cc::mojom::MojoCompositorFrameSinkRequest request) { 37 cc::mojom::MojoCompositorFrameSinkRequest request) {
38 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasCompositorFrameSink>( 38 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasCompositorFrameSink>(
39 surface_id, std::move(client)), 39 surface_id, std::move(client)),
40 std::move(request)); 40 std::move(request));
41 } 41 }
42 42
43 void OffscreenCanvasCompositorFrameSink::SubmitCompositorFrame( 43 void OffscreenCanvasCompositorFrameSink::SubmitCompositorFrame(
44 cc::CompositorFrame frame, 44 cc::CompositorFrame frame,
45 const SubmitCompositorFrameCallback& callback) { 45 const SubmitCompositorFrameCallback& callback) {
46 if (!surface_factory_) { 46 if (!surface_factory_) {
47 cc::SurfaceManager* manager = GetSurfaceManager(); 47 cc::SurfaceManager* manager = GetSurfaceManager();
48 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( 48 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(
49 surface_id_.frame_sink_id(), manager, this); 49 surface_id_.frame_sink_id(), manager, this);
50 surface_factory_->Create(surface_id_); 50 surface_factory_->Create(surface_id_.local_frame_id());
51 51
52 manager->RegisterFrameSinkId(surface_id_.frame_sink_id()); 52 manager->RegisterFrameSinkId(surface_id_.frame_sink_id());
53 } 53 }
54 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), 54 surface_factory_->SubmitCompositorFrame(surface_id_.local_frame_id(),
55 callback); 55 std::move(frame), callback);
56 } 56 }
57 57
58 void OffscreenCanvasCompositorFrameSink::SetNeedsBeginFrame( 58 void OffscreenCanvasCompositorFrameSink::SetNeedsBeginFrame(
59 bool needs_begin_frame) { 59 bool needs_begin_frame) {
60 NOTIMPLEMENTED(); 60 NOTIMPLEMENTED();
61 } 61 }
62 62
63 void OffscreenCanvasCompositorFrameSink::ReturnResources( 63 void OffscreenCanvasCompositorFrameSink::ReturnResources(
64 const cc::ReturnedResourceArray& resources) { 64 const cc::ReturnedResourceArray& resources) {
65 client_->ReturnResources(resources); 65 client_->ReturnResources(resources);
66 } 66 }
67 67
68 void OffscreenCanvasCompositorFrameSink::WillDrawSurface( 68 void OffscreenCanvasCompositorFrameSink::WillDrawSurface(
69 const cc::SurfaceId& id, 69 const cc::LocalFrameId& id,
70 const gfx::Rect& damage_rect) {} 70 const gfx::Rect& damage_rect) {}
71 71
72 void OffscreenCanvasCompositorFrameSink::SetBeginFrameSource( 72 void OffscreenCanvasCompositorFrameSink::SetBeginFrameSource(
73 cc::BeginFrameSource* begin_frame_source) {} 73 cc::BeginFrameSource* begin_frame_source) {}
74 74
75 } // namespace content 75 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698