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

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

Issue 2676373004: Implement service-side surface synchronization (Closed)
Patch Set: Better unit test name Created 3 years, 10 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // overlays. 212 // overlays.
213 bool output_partial_list = renderer_->use_partial_swap() && 213 bool output_partial_list = renderer_->use_partial_swap() &&
214 !output_surface_->GetOverlayCandidateValidator(); 214 !output_surface_->GetOverlayCandidateValidator();
215 aggregator_.reset(new SurfaceAggregator( 215 aggregator_.reset(new SurfaceAggregator(
216 surface_manager_, resource_provider_.get(), output_partial_list)); 216 surface_manager_, resource_provider_.get(), output_partial_list));
217 aggregator_->set_output_is_secure(output_is_secure_); 217 aggregator_->set_output_is_secure(output_is_secure_);
218 } 218 }
219 219
220 void Display::UpdateRootSurfaceResourcesLocked() { 220 void Display::UpdateRootSurfaceResourcesLocked() {
221 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_); 221 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_);
222 bool root_surface_resources_locked = !surface || !surface->HasFrame(); 222 bool root_surface_resources_locked = !surface || !surface->HasActiveFrame();
223 if (scheduler_) 223 if (scheduler_)
224 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked); 224 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked);
225 } 225 }
226 226
227 void Display::DidLoseContextProvider() { 227 void Display::DidLoseContextProvider() {
228 if (scheduler_) 228 if (scheduler_)
229 scheduler_->OutputSurfaceLost(); 229 scheduler_->OutputSurfaceLost();
230 // WARNING: The client may delete the Display in this method call. Do not 230 // WARNING: The client may delete the Display in this method call. Do not
231 // make any additional references to members after this call. 231 // make any additional references to members after this call.
232 client_->DisplayOutputSurfaceLost(); 232 client_->DisplayOutputSurfaceLost();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 aggregator_->SetFullDamageForSurface(current_surface_id_); 367 aggregator_->SetFullDamageForSurface(current_surface_id_);
368 if (scheduler_) 368 if (scheduler_)
369 scheduler_->SurfaceDamaged(current_surface_id_); 369 scheduler_->SurfaceDamaged(current_surface_id_);
370 } 370 }
371 371
372 void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) { 372 void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) {
373 if (aggregator_ && 373 if (aggregator_ &&
374 aggregator_->previous_contained_surfaces().count(surface_id)) { 374 aggregator_->previous_contained_surfaces().count(surface_id)) {
375 Surface* surface = surface_manager_->GetSurfaceForId(surface_id); 375 Surface* surface = surface_manager_->GetSurfaceForId(surface_id);
376 if (surface) { 376 if (surface) {
377 if (!surface->HasFrame() || 377 if (!surface->HasActiveFrame() ||
378 surface->GetEligibleFrame().resource_list.empty()) { 378 surface->GetActiveFrame().resource_list.empty()) {
379 aggregator_->ReleaseResources(surface_id); 379 aggregator_->ReleaseResources(surface_id);
380 } 380 }
381 } 381 }
382 if (scheduler_) 382 if (scheduler_)
383 scheduler_->SurfaceDamaged(surface_id); 383 scheduler_->SurfaceDamaged(surface_id);
384 *changed = true; 384 *changed = true;
385 } else if (surface_id == current_surface_id_) { 385 } else if (surface_id == current_surface_id_) {
386 if (scheduler_) 386 if (scheduler_)
387 scheduler_->SurfaceDamaged(surface_id); 387 scheduler_->SurfaceDamaged(surface_id);
388 *changed = true; 388 *changed = true;
389 } 389 }
390 390
391 if (surface_id == current_surface_id_) 391 if (surface_id == current_surface_id_)
392 UpdateRootSurfaceResourcesLocked(); 392 UpdateRootSurfaceResourcesLocked();
393 } 393 }
394 394
395 void Display::OnSurfaceCreated(const SurfaceInfo& surface_info) {} 395 void Display::OnSurfaceCreated(const SurfaceInfo& surface_info) {}
396 396
397 const SurfaceId& Display::CurrentSurfaceId() { 397 const SurfaceId& Display::CurrentSurfaceId() {
398 return current_surface_id_; 398 return current_surface_id_;
399 } 399 }
400 400
401 void Display::ForceImmediateDrawAndSwapIfPossible() { 401 void Display::ForceImmediateDrawAndSwapIfPossible() {
402 if (scheduler_) 402 if (scheduler_)
403 scheduler_->ForceImmediateSwapIfPossible(); 403 scheduler_->ForceImmediateSwapIfPossible();
404 } 404 }
405 405
406 } // namespace cc 406 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/local_surface_id.h » ('j') | cc/surfaces/surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698