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

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

Issue 2872883002: Rename EvictFrame, EvictSurface to EvictCurrentSurface (Closed)
Patch Set: Rebase Created 3 years, 7 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 27 matching lines...) Expand all
38 // Unregister |this| as a BeginFrameObserver so that the BeginFrameSource does 38 // Unregister |this| as a BeginFrameObserver so that the BeginFrameSource does
39 // not call into |this| after it's deleted. 39 // not call into |this| after it's deleted.
40 SetNeedsBeginFrame(false); 40 SetNeedsBeginFrame(false);
41 41
42 // For display root surfaces, the surface is no longer going to be visible 42 // For display root surfaces, the surface is no longer going to be visible
43 // so make it unreachable from the top-level root. 43 // so make it unreachable from the top-level root.
44 if (surface_manager_->using_surface_references() && is_root_ && 44 if (surface_manager_->using_surface_references() && is_root_ &&
45 reference_tracker_.current_surface_id().is_valid()) 45 reference_tracker_.current_surface_id().is_valid())
46 RemoveTopLevelRootReference(reference_tracker_.current_surface_id()); 46 RemoveTopLevelRootReference(reference_tracker_.current_surface_id());
47 47
48 EvictFrame(); 48 EvictCurrentSurface();
49 surface_manager_->UnregisterFrameSinkManagerClient(frame_sink_id_); 49 surface_manager_->UnregisterFrameSinkManagerClient(frame_sink_id_);
50 if (handles_frame_sink_id_invalidation_) 50 if (handles_frame_sink_id_invalidation_)
51 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); 51 surface_manager_->InvalidateFrameSinkId(frame_sink_id_);
52 } 52 }
53 53
54 void CompositorFrameSinkSupport::ReturnResources( 54 void CompositorFrameSinkSupport::ReturnResources(
55 const ReturnedResourceArray& resources) { 55 const ReturnedResourceArray& resources) {
56 if (resources.empty()) 56 if (resources.empty())
57 return; 57 return;
58 if (!ack_pending_count_ && client_) { 58 if (!ack_pending_count_ && client_) {
59 client_->ReclaimResources(resources); 59 client_->ReclaimResources(resources);
60 return; 60 return;
61 } 61 }
62 62
63 std::copy(resources.begin(), resources.end(), 63 std::copy(resources.begin(), resources.end(),
64 std::back_inserter(surface_returned_resources_)); 64 std::back_inserter(surface_returned_resources_));
65 } 65 }
66 66
67 void CompositorFrameSinkSupport::SetBeginFrameSource( 67 void CompositorFrameSinkSupport::SetBeginFrameSource(
68 BeginFrameSource* begin_frame_source) { 68 BeginFrameSource* begin_frame_source) {
69 if (begin_frame_source_ && added_frame_observer_) { 69 if (begin_frame_source_ && added_frame_observer_) {
70 begin_frame_source_->RemoveObserver(this); 70 begin_frame_source_->RemoveObserver(this);
71 added_frame_observer_ = false; 71 added_frame_observer_ = false;
72 } 72 }
73 begin_frame_source_ = begin_frame_source; 73 begin_frame_source_ = begin_frame_source;
74 UpdateNeedsBeginFramesInternal(); 74 UpdateNeedsBeginFramesInternal();
75 } 75 }
76 76
77 void CompositorFrameSinkSupport::EvictFrame() { 77 void CompositorFrameSinkSupport::EvictCurrentSurface() {
78 if (!current_surface_) 78 if (!current_surface_)
79 return; 79 return;
80 DestroyCurrentSurface(); 80 DestroyCurrentSurface();
81 } 81 }
82 82
83 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) { 83 void CompositorFrameSinkSupport::SetNeedsBeginFrame(bool needs_begin_frame) {
84 needs_begin_frame_ = needs_begin_frame; 84 needs_begin_frame_ = needs_begin_frame;
85 UpdateNeedsBeginFramesInternal(); 85 UpdateNeedsBeginFramesInternal();
86 } 86 }
87 87
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 std::unique_ptr<CopyOutputRequest> copy_request) { 347 std::unique_ptr<CopyOutputRequest> copy_request) {
348 if (!current_surface_) 348 if (!current_surface_)
349 return; 349 return;
350 350
351 DCHECK(current_surface_->compositor_frame_sink_support().get() == this); 351 DCHECK(current_surface_->compositor_frame_sink_support().get() == this);
352 current_surface_->RequestCopyOfOutput(std::move(copy_request)); 352 current_surface_->RequestCopyOfOutput(std::move(copy_request));
353 surface_manager_->SurfaceModified(current_surface_->surface_id()); 353 surface_manager_->SurfaceModified(current_surface_->surface_id());
354 } 354 }
355 355
356 } // namespace cc 356 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698