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

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

Issue 2167713002: cc: Delete SurfaceDrawStatus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Scott's comments Created 4 years, 5 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 | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_aggregator.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 "cc/surfaces/surface.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 17 matching lines...) Expand all
28 factory_(factory->AsWeakPtr()), 28 factory_(factory->AsWeakPtr()),
29 frame_index_(kFrameIndexStart), 29 frame_index_(kFrameIndexStart),
30 destroyed_(false) {} 30 destroyed_(false) {}
31 31
32 Surface::~Surface() { 32 Surface::~Surface() {
33 ClearCopyRequests(); 33 ClearCopyRequests();
34 if (current_frame_.delegated_frame_data && factory_) { 34 if (current_frame_.delegated_frame_data && factory_) {
35 UnrefFrameResources(current_frame_.delegated_frame_data.get()); 35 UnrefFrameResources(current_frame_.delegated_frame_data.get());
36 } 36 }
37 if (!draw_callback_.is_null()) 37 if (!draw_callback_.is_null())
38 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); 38 draw_callback_.Run();
39 } 39 }
40 40
41 void Surface::SetPreviousFrameSurface(Surface* surface) { 41 void Surface::SetPreviousFrameSurface(Surface* surface) {
42 DCHECK(surface); 42 DCHECK(surface);
43 frame_index_ = surface->frame_index() + 1; 43 frame_index_ = surface->frame_index() + 1;
44 previous_frame_surface_id_ = surface->surface_id(); 44 previous_frame_surface_id_ = surface->surface_id();
45 } 45 }
46 46
47 void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) { 47 void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) {
48 DCHECK(factory_); 48 DCHECK(factory_);
(...skipping 20 matching lines...) Expand all
69 69
70 previous_frame_surface_id_ = surface_id(); 70 previous_frame_surface_id_ = surface_id();
71 71
72 std::vector<SurfaceId> new_referenced_surfaces; 72 std::vector<SurfaceId> new_referenced_surfaces;
73 new_referenced_surfaces = current_frame_.metadata.referenced_surfaces; 73 new_referenced_surfaces = current_frame_.metadata.referenced_surfaces;
74 74
75 if (previous_frame.delegated_frame_data) 75 if (previous_frame.delegated_frame_data)
76 UnrefFrameResources(previous_frame.delegated_frame_data.get()); 76 UnrefFrameResources(previous_frame.delegated_frame_data.get());
77 77
78 if (!draw_callback_.is_null()) 78 if (!draw_callback_.is_null())
79 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); 79 draw_callback_.Run();
80 draw_callback_ = callback; 80 draw_callback_ = callback;
81 81
82 bool referenced_surfaces_changed = 82 bool referenced_surfaces_changed =
83 (referenced_surfaces_ != new_referenced_surfaces); 83 (referenced_surfaces_ != new_referenced_surfaces);
84 referenced_surfaces_ = new_referenced_surfaces; 84 referenced_surfaces_ = new_referenced_surfaces;
85 std::vector<uint32_t> satisfies_sequences = 85 std::vector<uint32_t> satisfies_sequences =
86 std::move(current_frame_.metadata.satisfies_sequences); 86 std::move(current_frame_.metadata.satisfies_sequences);
87 87
88 if (referenced_surfaces_changed || !satisfies_sequences.empty()) { 88 if (referenced_surfaces_changed || !satisfies_sequences.empty()) {
89 // Notify the manager that sequences were satisfied either if some new 89 // Notify the manager that sequences were satisfied either if some new
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (latency_info->empty()) { 144 if (latency_info->empty()) {
145 current_frame_.metadata.latency_info.swap(*latency_info); 145 current_frame_.metadata.latency_info.swap(*latency_info);
146 return; 146 return;
147 } 147 }
148 std::copy(current_frame_.metadata.latency_info.begin(), 148 std::copy(current_frame_.metadata.latency_info.begin(),
149 current_frame_.metadata.latency_info.end(), 149 current_frame_.metadata.latency_info.end(),
150 std::back_inserter(*latency_info)); 150 std::back_inserter(*latency_info));
151 current_frame_.metadata.latency_info.clear(); 151 current_frame_.metadata.latency_info.clear();
152 } 152 }
153 153
154 void Surface::RunDrawCallbacks(SurfaceDrawStatus drawn) { 154 void Surface::RunDrawCallbacks() {
155 if (!draw_callback_.is_null()) { 155 if (!draw_callback_.is_null()) {
156 DrawCallback callback = draw_callback_; 156 DrawCallback callback = draw_callback_;
157 draw_callback_ = DrawCallback(); 157 draw_callback_ = DrawCallback();
158 callback.Run(drawn); 158 callback.Run();
159 } 159 }
160 } 160 }
161 161
162 void Surface::AddDestructionDependency(SurfaceSequence sequence) { 162 void Surface::AddDestructionDependency(SurfaceSequence sequence) {
163 destruction_dependencies_.push_back(sequence); 163 destruction_dependencies_.push_back(sequence);
164 } 164 }
165 165
166 void Surface::SatisfyDestructionDependencies( 166 void Surface::SatisfyDestructionDependencies(
167 std::unordered_set<SurfaceSequence, SurfaceSequenceHash>* sequences, 167 std::unordered_set<SurfaceSequence, SurfaceSequenceHash>* sequences,
168 std::unordered_set<uint32_t>* valid_client_ids) { 168 std::unordered_set<uint32_t>* valid_client_ids) {
(...skipping 20 matching lines...) Expand all
189 if (current_frame_.delegated_frame_data) { 189 if (current_frame_.delegated_frame_data) {
190 for (const auto& render_pass : 190 for (const auto& render_pass :
191 current_frame_.delegated_frame_data->render_pass_list) { 191 current_frame_.delegated_frame_data->render_pass_list) {
192 for (const auto& copy_request : render_pass->copy_requests) 192 for (const auto& copy_request : render_pass->copy_requests)
193 copy_request->SendEmptyResult(); 193 copy_request->SendEmptyResult();
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 } // namespace cc 198 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface.h ('k') | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698