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

Side by Side Diff: cc/resources/tile_manager.cc

Issue 219963005: cc: Add support for partial swaps when using impl-side painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP - optimize damage rect in LTHI Created 6 years, 8 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/resources/tile_manager.h ('k') | cc/trees/layer_tree_host_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/tile_manager.h" 5 #include "cc/resources/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 rendering_stats_instrumentation_(rendering_stats_instrumentation), 455 rendering_stats_instrumentation_(rendering_stats_instrumentation),
456 did_initialize_visible_tile_(false), 456 did_initialize_visible_tile_(false),
457 did_check_for_completed_tasks_since_last_schedule_tasks_(true), 457 did_check_for_completed_tasks_since_last_schedule_tasks_(true),
458 use_rasterize_on_demand_(use_rasterize_on_demand) { 458 use_rasterize_on_demand_(use_rasterize_on_demand) {
459 RasterWorkerPool* raster_worker_pools[NUM_RASTER_WORKER_POOL_TYPES] = { 459 RasterWorkerPool* raster_worker_pools[NUM_RASTER_WORKER_POOL_TYPES] = {
460 raster_worker_pool_.get(), // RASTER_WORKER_POOL_TYPE_DEFAULT 460 raster_worker_pool_.get(), // RASTER_WORKER_POOL_TYPE_DEFAULT
461 direct_raster_worker_pool_.get() // RASTER_WORKER_POOL_TYPE_DIRECT 461 direct_raster_worker_pool_.get() // RASTER_WORKER_POOL_TYPE_DIRECT
462 }; 462 };
463 raster_worker_pool_delegate_ = RasterWorkerPoolDelegate::Create( 463 raster_worker_pool_delegate_ = RasterWorkerPoolDelegate::Create(
464 this, raster_worker_pools, arraysize(raster_worker_pools)); 464 this, raster_worker_pools, arraysize(raster_worker_pools));
465 damage_rect_ = gfx::Rect(0, 0, 0, 0);
465 } 466 }
466 467
467 TileManager::~TileManager() { 468 TileManager::~TileManager() {
468 // Reset global state and manage. This should cause 469 // Reset global state and manage. This should cause
469 // our memory usage to drop to zero. 470 // our memory usage to drop to zero.
470 global_state_ = GlobalStateThatImpactsTilePriority(); 471 global_state_ = GlobalStateThatImpactsTilePriority();
471 472
472 CleanUpReleasedTiles(); 473 CleanUpReleasedTiles();
473 DCHECK_EQ(0u, tiles_.size()); 474 DCHECK_EQ(0u, tiles_.size());
474 475
(...skipping 15 matching lines...) Expand all
490 (*it)->DidUnregisterLayer(); 491 (*it)->DidUnregisterLayer();
491 } 492 }
492 layers_.clear(); 493 layers_.clear();
493 } 494 }
494 495
495 void TileManager::Release(Tile* tile) { 496 void TileManager::Release(Tile* tile) {
496 prioritized_tiles_dirty_ = true; 497 prioritized_tiles_dirty_ = true;
497 released_tiles_.push_back(tile); 498 released_tiles_.push_back(tile);
498 } 499 }
499 500
501 void TileManager::ResetDamagedRect() { damage_rect_ = gfx::Rect(0, 0, 0, 0); }
502
503 gfx::Rect TileManager::GetDamagedRect() { return damage_rect_; }
504
500 void TileManager::DidChangeTilePriority(Tile* tile) { 505 void TileManager::DidChangeTilePriority(Tile* tile) {
501 prioritized_tiles_dirty_ = true; 506 prioritized_tiles_dirty_ = true;
502 } 507 }
503 508
504 bool TileManager::ShouldForceTasksRequiredForActivationToComplete() const { 509 bool TileManager::ShouldForceTasksRequiredForActivationToComplete() const {
505 return global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY; 510 return global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY;
506 } 511 }
507 512
508 void TileManager::CleanUpReleasedTiles() { 513 void TileManager::CleanUpReleasedTiles() {
509 for (std::vector<Tile*>::iterator it = released_tiles_.begin(); 514 for (std::vector<Tile*>::iterator it = released_tiles_.begin();
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 DCHECK(tile_version.raster_task_); 1230 DCHECK(tile_version.raster_task_);
1226 orphan_raster_tasks_.push_back(tile_version.raster_task_); 1231 orphan_raster_tasks_.push_back(tile_version.raster_task_);
1227 tile_version.raster_task_ = NULL; 1232 tile_version.raster_task_ = NULL;
1228 1233
1229 if (was_canceled) { 1234 if (was_canceled) {
1230 ++update_visible_tiles_stats_.canceled_count; 1235 ++update_visible_tiles_stats_.canceled_count;
1231 resource_pool_->ReleaseResource(resource.Pass()); 1236 resource_pool_->ReleaseResource(resource.Pass());
1232 return; 1237 return;
1233 } 1238 }
1234 1239
1240 // Union damage rect with current tile's content rect.
1241 damage_rect_ = gfx::UnionRects(damage_rect_, tile->content_rect());
danakj 2014/04/01 14:22:51 What space is the damage_rect_ in? If it's in scre
1242
1235 ++update_visible_tiles_stats_.completed_count; 1243 ++update_visible_tiles_stats_.completed_count;
1236 1244
1237 tile_version.set_has_text(analysis.has_text); 1245 tile_version.set_has_text(analysis.has_text);
1238 if (analysis.is_solid_color) { 1246 if (analysis.is_solid_color) {
1239 tile_version.set_solid_color(analysis.solid_color); 1247 tile_version.set_solid_color(analysis.solid_color);
1240 resource_pool_->ReleaseResource(resource.Pass()); 1248 resource_pool_->ReleaseResource(resource.Pass());
1241 } else { 1249 } else {
1242 tile_version.set_use_resource(); 1250 tile_version.set_use_resource();
1243 tile_version.resource_ = resource.Pass(); 1251 tile_version.resource_ = resource.Pass();
1244 1252
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 } 1338 }
1331 } 1339 }
1332 } 1340 }
1333 1341
1334 TileManager::PairedPictureLayer::PairedPictureLayer() 1342 TileManager::PairedPictureLayer::PairedPictureLayer()
1335 : active_layer(NULL), pending_layer(NULL) {} 1343 : active_layer(NULL), pending_layer(NULL) {}
1336 1344
1337 TileManager::PairedPictureLayer::~PairedPictureLayer() {} 1345 TileManager::PairedPictureLayer::~PairedPictureLayer() {}
1338 1346
1339 } // namespace cc 1347 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698