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

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

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. 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 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/display.h" 5 #include "cc/surfaces/display.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 TRACE_EVENT1("cc", "Display::SetVisible", "visible", visible); 109 TRACE_EVENT1("cc", "Display::SetVisible", "visible", visible);
110 if (renderer_) 110 if (renderer_)
111 renderer_->SetVisible(visible); 111 renderer_->SetVisible(visible);
112 if (scheduler_) 112 if (scheduler_)
113 scheduler_->SetVisible(visible); 113 scheduler_->SetVisible(visible);
114 visible_ = visible; 114 visible_ = visible;
115 115
116 if (!visible) { 116 if (!visible) {
117 // Damage tracker needs a full reset as renderer resources are dropped when 117 // Damage tracker needs a full reset as renderer resources are dropped when
118 // not visible. 118 // not visible.
119 if (aggregator_ && !current_surface_id_.is_null()) 119 if (aggregator_ && current_surface_id_.is_valid())
120 aggregator_->SetFullDamageForSurface(current_surface_id_); 120 aggregator_->SetFullDamageForSurface(current_surface_id_);
121 } 121 }
122 } 122 }
123 123
124 void Display::Resize(const gfx::Size& size) { 124 void Display::Resize(const gfx::Size& size) {
125 if (size == current_surface_size_) 125 if (size == current_surface_size_)
126 return; 126 return;
127 127
128 TRACE_EVENT0("cc", "Display::Resize"); 128 TRACE_EVENT0("cc", "Display::Resize");
129 129
(...skipping 17 matching lines...) Expand all
147 } 147 }
148 148
149 void Display::SetOutputIsSecure(bool secure) { 149 void Display::SetOutputIsSecure(bool secure) {
150 if (secure == output_is_secure_) 150 if (secure == output_is_secure_)
151 return; 151 return;
152 output_is_secure_ = secure; 152 output_is_secure_ = secure;
153 153
154 if (aggregator_) { 154 if (aggregator_) {
155 aggregator_->set_output_is_secure(secure); 155 aggregator_->set_output_is_secure(secure);
156 // Force a redraw. 156 // Force a redraw.
157 if (!current_surface_id_.is_null()) 157 if (current_surface_id_.is_valid())
158 aggregator_->SetFullDamageForSurface(current_surface_id_); 158 aggregator_->SetFullDamageForSurface(current_surface_id_);
159 } 159 }
160 } 160 }
161 161
162 void Display::InitializeRenderer() { 162 void Display::InitializeRenderer() {
163 // Not relevant for display compositor since it's not delegated. 163 // Not relevant for display compositor since it's not delegated.
164 bool delegated_sync_points_required = false; 164 bool delegated_sync_points_required = false;
165 resource_provider_.reset(new ResourceProvider( 165 resource_provider_.reset(new ResourceProvider(
166 output_surface_->context_provider(), bitmap_manager_, 166 output_surface_->context_provider(), bitmap_manager_,
167 gpu_memory_buffer_manager_, nullptr, settings_.highp_threshold_min, 167 gpu_memory_buffer_manager_, nullptr, settings_.highp_threshold_min,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_); 214 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_);
215 bool root_surface_resources_locked = 215 bool root_surface_resources_locked =
216 !surface || !surface->GetEligibleFrame().delegated_frame_data; 216 !surface || !surface->GetEligibleFrame().delegated_frame_data;
217 if (scheduler_) 217 if (scheduler_)
218 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked); 218 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked);
219 } 219 }
220 220
221 bool Display::DrawAndSwap() { 221 bool Display::DrawAndSwap() {
222 TRACE_EVENT0("cc", "Display::DrawAndSwap"); 222 TRACE_EVENT0("cc", "Display::DrawAndSwap");
223 223
224 if (current_surface_id_.is_null()) { 224 if (!current_surface_id_.is_valid()) {
225 TRACE_EVENT_INSTANT0("cc", "No root surface.", TRACE_EVENT_SCOPE_THREAD); 225 TRACE_EVENT_INSTANT0("cc", "No root surface.", TRACE_EVENT_SCOPE_THREAD);
226 return false; 226 return false;
227 } 227 }
228 228
229 if (!output_surface_) { 229 if (!output_surface_) {
230 TRACE_EVENT_INSTANT0("cc", "No output surface", TRACE_EVENT_SCOPE_THREAD); 230 TRACE_EVENT_INSTANT0("cc", "No output surface", TRACE_EVENT_SCOPE_THREAD);
231 return false; 231 return false;
232 } 232 }
233 233
234 CompositorFrame frame = aggregator_->Aggregate(current_surface_id_); 234 CompositorFrame frame = aggregator_->Aggregate(current_surface_id_);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 const SurfaceId& Display::CurrentSurfaceId() { 388 const SurfaceId& Display::CurrentSurfaceId() {
389 return current_surface_id_; 389 return current_surface_id_;
390 } 390 }
391 391
392 void Display::ForceImmediateDrawAndSwapIfPossible() { 392 void Display::ForceImmediateDrawAndSwapIfPossible() {
393 if (scheduler_) 393 if (scheduler_)
394 scheduler_->ForceImmediateSwapIfPossible(); 394 scheduler_->ForceImmediateSwapIfPossible();
395 } 395 }
396 396
397 } // namespace cc 397 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698