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

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

Issue 1673783004: Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Register id namespace on Android Created 4 years, 9 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_aggregator.h ('k') | cc/surfaces/surface_aggregator_perftest.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_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 24 matching lines...) Expand all
35 auto request_range = copy_requests->equal_range(id); 35 auto request_range = copy_requests->equal_range(id);
36 for (auto it = request_range.first; it != request_range.second; ++it) { 36 for (auto it = request_range.first; it != request_range.second; ++it) {
37 DCHECK(it->second); 37 DCHECK(it->second);
38 output_requests->push_back(std::move(it->second)); 38 output_requests->push_back(std::move(it->second));
39 } 39 }
40 copy_requests->erase(request_range.first, request_range.second); 40 copy_requests->erase(request_range.first, request_range.second);
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
45 SurfaceAggregator::SurfaceAggregator(SurfaceAggregatorClient* client, 45 SurfaceAggregator::SurfaceAggregator(SurfaceManager* manager,
46 SurfaceManager* manager,
47 ResourceProvider* provider, 46 ResourceProvider* provider,
48 bool aggregate_only_damaged) 47 bool aggregate_only_damaged)
49 : client_(client), 48 : manager_(manager),
50 manager_(manager),
51 provider_(provider), 49 provider_(provider),
52 next_render_pass_id_(1), 50 next_render_pass_id_(1),
53 aggregate_only_damaged_(aggregate_only_damaged), 51 aggregate_only_damaged_(aggregate_only_damaged),
54 weak_factory_(this) { 52 weak_factory_(this) {
55 DCHECK(manager_); 53 DCHECK(manager_);
56 } 54 }
57 55
58 SurfaceAggregator::~SurfaceAggregator() { 56 SurfaceAggregator::~SurfaceAggregator() {
59 // Notify client of all surfaces being removed. 57 // Notify client of all surfaces being removed.
60 contained_surfaces_.clear(); 58 contained_surfaces_.clear();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 surface_id_to_resource_child_id_.find(surface.first); 470 surface_id_to_resource_child_id_.find(surface.first);
473 if (it != surface_id_to_resource_child_id_.end()) { 471 if (it != surface_id_to_resource_child_id_.end()) {
474 provider_->DestroyChild(it->second); 472 provider_->DestroyChild(it->second);
475 surface_id_to_resource_child_id_.erase(it); 473 surface_id_to_resource_child_id_.erase(it);
476 } 474 }
477 475
478 // Notify client of removed surface. 476 // Notify client of removed surface.
479 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first); 477 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
480 if (surface_ptr) { 478 if (surface_ptr) {
481 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED); 479 surface_ptr->RunDrawCallbacks(SurfaceDrawStatus::DRAW_SKIPPED);
482 client_->RemoveSurface(surface_ptr);
483 } 480 }
484 } 481 }
485 } 482 }
486
487 for (const auto& surface : contained_surfaces_) {
488 if (!previous_contained_surfaces_.count(surface.first)) {
489 // Notify client of added surface.
490 Surface* surface_ptr = manager_->GetSurfaceForId(surface.first);
491 if (surface_ptr)
492 client_->AddSurface(surface_ptr);
493 }
494 }
495 } 483 }
496 484
497 // Walk the Surface tree from surface_id. Validate the resources of the current 485 // Walk the Surface tree from surface_id. Validate the resources of the current
498 // surface and its descendants, check if there are any copy requests, and 486 // surface and its descendants, check if there are any copy requests, and
499 // return the combined damage rect. 487 // return the combined damage rect.
500 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id, 488 gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id,
501 PrewalkResult* result) { 489 PrewalkResult* result) {
502 // This is for debugging a possible use after free. 490 // This is for debugging a possible use after free.
503 // TODO(jbauman): Remove this once we have enough information. 491 // TODO(jbauman): Remove this once we have enough information.
504 // http://crbug.com/560181 492 // http://crbug.com/560181
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 706
719 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { 707 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) {
720 auto it = previous_contained_surfaces_.find(surface_id); 708 auto it = previous_contained_surfaces_.find(surface_id);
721 if (it == previous_contained_surfaces_.end()) 709 if (it == previous_contained_surfaces_.end())
722 return; 710 return;
723 // Set the last drawn index as 0 to ensure full damage next time it's drawn. 711 // Set the last drawn index as 0 to ensure full damage next time it's drawn.
724 it->second = 0; 712 it->second = 0;
725 } 713 }
726 714
727 } // namespace cc 715 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator.h ('k') | cc/surfaces/surface_aggregator_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698