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

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

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 source.has_transparent_background); 443 source.has_transparent_background);
444 444
445 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list, 445 CopyQuadsToPass(source.quad_list, source.shared_quad_state_list,
446 child_to_parent_map, gfx::Transform(), ClipData(), 446 child_to_parent_map, gfx::Transform(), ClipData(),
447 copy_pass.get(), surface->surface_id()); 447 copy_pass.get(), surface->surface_id());
448 448
449 dest_pass_list_->push_back(copy_pass.Pass()); 449 dest_pass_list_->push_back(copy_pass.Pass());
450 } 450 }
451 } 451 }
452 452
453 void SurfaceAggregator::RemoveUnreferencedChildren() { 453 void SurfaceAggregator::RemoveUnreferencedChildren() {
brianderson 2015/09/04 21:56:51 @jbauman: We are using this function to notify the
jbauman 2015/09/04 23:58:36 This generally makes sense, though I think we'd wa
454 for (const auto& surface : previous_contained_surfaces_) { 454 for (const auto& surface : previous_contained_surfaces_) {
455 if (!contained_surfaces_.count(surface.first)) { 455 if (!contained_surfaces_.count(surface.first)) {
456 SurfaceToResourceChildIdMap::iterator it = 456 SurfaceToResourceChildIdMap::iterator it =
457 surface_id_to_resource_child_id_.find(surface.first); 457 surface_id_to_resource_child_id_.find(surface.first);
458 if (it != surface_id_to_resource_child_id_.end()) { 458 if (it != surface_id_to_resource_child_id_.end()) {
459 provider_->DestroyChild(it->second); 459 provider_->DestroyChild(it->second);
460 surface_id_to_resource_child_id_.erase(it); 460 surface_id_to_resource_child_id_.erase(it);
461 } 461 }
462 462
463 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first); 463 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
464 if (surface_ptr) 464 if (surface_ptr) {
465 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED); 465 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED);
466 // FIXME(brianderson): Make the aggregator take the display_ object.
467 surface_ptr->RemoveDisplay(display_);
468 }
469 }
470 }
471
472 for (const auto& surface : contained_surfaces_) {
473 if (!previous_contained_surfaces_.count(surface.first)) {
474 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
475 if (surface_ptr) {
476 surface_ptr->AddDisplay(display_);
477 }
466 } 478 }
467 } 479 }
468 } 480 }
469 481
470 // Walk the Surface tree from surface_id. Validate the resources of the current 482 // Walk the Surface tree from surface_id. Validate the resources of the current
471 // surface and its descendants, check if there are any copy requests, and 483 // surface and its descendants, check if there are any copy requests, and
472 // return the combined damage rect. 484 // return the combined damage rect.
473 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) { 485 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id) {
474 if (referenced_surfaces_.count(surface_id)) 486 if (referenced_surfaces_.count(surface_id))
475 return gfx::Rect(); 487 return gfx::Rect();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 643
632 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 644 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
633 auto it = previous_contained_surfaces_.find(surface_id); 645 auto it = previous_contained_surfaces_.find(surface_id);
634 if (it == previous_contained_surfaces_.end()) 646 if (it == previous_contained_surfaces_.end())
635 return; 647 return;
636 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 648 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
637 it->second = 0; 649 it->second = 0;
638 } 650 }
639 651
640 } // namespace cc 652 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698