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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: More Init Created 3 years, 8 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 "cc/surfaces/compositor_frame_sink_support.h" 5 #include "cc/surfaces/compositor_frame_sink_support.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 15 matching lines...) Expand all
26 bool needs_sync_points) 26 bool needs_sync_points)
27 : client_(client), 27 : client_(client),
28 surface_manager_(surface_manager), 28 surface_manager_(surface_manager),
29 frame_sink_id_(frame_sink_id), 29 frame_sink_id_(frame_sink_id),
30 surface_factory_(frame_sink_id_, surface_manager_, this), 30 surface_factory_(frame_sink_id_, surface_manager_, this),
31 reference_tracker_(frame_sink_id), 31 reference_tracker_(frame_sink_id),
32 is_root_(is_root), 32 is_root_(is_root),
33 handles_frame_sink_id_invalidation_(handles_frame_sink_id_invalidation), 33 handles_frame_sink_id_invalidation_(handles_frame_sink_id_invalidation),
34 weak_factory_(this) { 34 weak_factory_(this) {
35 surface_factory_.set_needs_sync_points(needs_sync_points); 35 surface_factory_.set_needs_sync_points(needs_sync_points);
36 if (handles_frame_sink_id_invalidation_)
37 surface_manager_->RegisterFrameSinkId(frame_sink_id_);
38 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
39 } 36 }
40 37
41 CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { 38 CompositorFrameSinkSupport::~CompositorFrameSinkSupport() {
42 // Unregister |this| as a BeginFrameObserver so that the BeginFrameSource does 39 // Unregister |this| as a BeginFrameObserver so that the BeginFrameSource does
43 // not call into |this| after it's deleted. 40 // not call into |this| after it's deleted.
44 SetNeedsBeginFrame(false); 41 SetNeedsBeginFrame(false);
45 42
46 // For display root surfaces, the surface is no longer going to be visible 43 // For display root surfaces, the surface is no longer going to be visible
47 // so make it unreachable from the top-level root. 44 // so make it unreachable from the top-level root.
48 if (surface_manager_->using_surface_references() && is_root_ && 45 if (surface_manager_->using_surface_references() && is_root_ &&
49 reference_tracker_.current_surface_id().is_valid()) 46 reference_tracker_.current_surface_id().is_valid())
50 RemoveTopLevelRootReference(reference_tracker_.current_surface_id()); 47 RemoveTopLevelRootReference(reference_tracker_.current_surface_id());
51 48
52 // SurfaceFactory's destructor will attempt to return resources which will 49 // SurfaceFactory's destructor will attempt to return resources which will
53 // call back into here and access |client_| so we should destroy 50 // call back into here and access |client_| so we should destroy
54 // |surface_factory_|'s resources early on. 51 // |surface_factory_|'s resources early on.
55 surface_factory_.EvictSurface(); 52 surface_factory_.EvictSurface();
56 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); 53 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_);
57 if (handles_frame_sink_id_invalidation_) 54 if (handles_frame_sink_id_invalidation_)
58 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); 55 surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
59 } 56 }
60 57
58 void CompositorFrameSinkSupport::Init() {
59 if (handles_frame_sink_id_invalidation_)
60 surface_manager_->RegisterFrameSinkId(frame_sink_id_);
61 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
62 }
63
61 void CompositorFrameSinkSupport::EvictFrame() { 64 void CompositorFrameSinkSupport::EvictFrame() {
62 surface_factory_.EvictSurface(); 65 surface_factory_.EvictSurface();
63 } 66 }
64 67
65 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) { 68 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) {
66 needs_begin_frame_ = needs_begin_frame; 69 needs_begin_frame_ = needs_begin_frame;
67 UpdateNeedsBeginFramesInternal(); 70 UpdateNeedsBeginFramesInternal();
68 } 71 }
69 72
70 void CompositorFrameSinkSupport::BeginFrameDidNotSwap( 73 void CompositorFrameSinkSupport::BeginFrameDidNotSwap(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 else 264 else
262 begin_frame_source_->RemoveObserver(this); 265 begin_frame_source_->RemoveObserver(this);
263 } 266 }
264 267
265 void CompositorFrameSinkSupport::RequestCopyOfSurface( 268 void CompositorFrameSinkSupport::RequestCopyOfSurface(
266 std::unique_ptr<CopyOutputRequest> request) { 269 std::unique_ptr<CopyOutputRequest> request) {
267 surface_factory_.RequestCopyOfSurface(std::move(request)); 270 surface_factory_.RequestCopyOfSurface(std::move(request));
268 } 271 }
269 272
270 } // namespace cc 273 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698