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

Unified Diff: cc/resources/tile_manager.cc

Issue 287643004: Re-land: cc: Examine layers to determine if we're ready to activate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 1c04d077f106ecabe69a71cd6b4d5482b4f5aceb..a81614ae2a58ae774010a05f05e9b9362711f1dc 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -366,27 +366,28 @@ scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue(
// static
scoped_ptr<TileManager> TileManager::Create(
TileManagerClient* client,
+ base::SequencedTaskRunner* task_runner,
ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
- bool use_rasterize_on_demand,
RenderingStatsInstrumentation* rendering_stats_instrumentation) {
return make_scoped_ptr(new TileManager(client,
+ task_runner,
resource_pool,
rasterizer,
gpu_rasterizer,
- use_rasterize_on_demand,
rendering_stats_instrumentation));
}
TileManager::TileManager(
TileManagerClient* client,
+ base::SequencedTaskRunner* task_runner,
ResourcePool* resource_pool,
Rasterizer* rasterizer,
Rasterizer* gpu_rasterizer,
- bool use_rasterize_on_demand,
RenderingStatsInstrumentation* rendering_stats_instrumentation)
: client_(client),
+ task_runner_(task_runner),
resource_pool_(resource_pool),
prioritized_tiles_dirty_(false),
all_tiles_that_need_to_be_rasterized_have_memory_(true),
@@ -399,7 +400,8 @@ TileManager::TileManager(
rendering_stats_instrumentation_(rendering_stats_instrumentation),
did_initialize_visible_tile_(false),
did_check_for_completed_tasks_since_last_schedule_tasks_(true),
- use_rasterize_on_demand_(use_rasterize_on_demand) {
+ check_if_ready_to_activate_pending_(false),
+ weak_ptr_factory_(this) {
Rasterizer* rasterizers[NUM_RASTERIZER_TYPES] = {
rasterizer, // RASTERIZER_TYPE_DEFAULT
gpu_rasterizer, // RASTERIZER_TYPE_GPU
@@ -536,12 +538,14 @@ void TileManager::DidFinishRunningTasks() {
// If we can't raster on demand, give up early (and don't activate).
if (!allow_rasterize_on_demand)
return;
- if (use_rasterize_on_demand_)
- tile_version.set_rasterize_on_demand();
+
+ tile_version.set_rasterize_on_demand();
+ client_->NotifyTileInitialized(tile);
vmpstr 2014/05/15 17:46:23 This means that we might end up calling NotifyTile
reveman 2014/05/15 19:01:43 That's already the case as we have multiple tile v
vmpstr 2014/05/16 00:38:45 Fair enough. I agree that with versions it should
}
}
- client_->NotifyReadyToActivate();
+ DCHECK(IsReadyToActivate());
+ ScheduleCheckIfReadyToActivate();
}
void TileManager::DidFinishRunningTasksRequiredForActivation() {
@@ -553,7 +557,7 @@ void TileManager::DidFinishRunningTasksRequiredForActivation() {
if (!all_tiles_required_for_activation_have_memory_)
return;
- client_->NotifyReadyToActivate();
+ ScheduleCheckIfReadyToActivate();
}
void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) {
@@ -890,7 +894,7 @@ void TileManager::AssignGpuMemoryToTiles(
// This tile was already on screen and now its resources have been
// released. In order to prevent checkerboarding, set this tile as
// rasterize on demand immediately.
- if (mts.visible_and_ready_to_draw && use_rasterize_on_demand_)
vmpstr 2014/05/15 17:46:23 Why this change?
reveman 2014/05/15 19:01:43 We can't handle situations where the renderer does
vmpstr 2014/05/16 00:38:45 I don't follow. This part was there to prevent us
reveman 2014/05/16 16:50:13 This patch just moves the awareness of support for
vmpstr 2014/05/16 17:09:06 Oh, I missed the bit where it's handled in AppendQ
+ if (mts.visible_and_ready_to_draw)
tile_version.set_rasterize_on_demand();
oomed_soft = true;
@@ -1616,4 +1620,36 @@ bool TileManager::EvictionTileIterator::EvictionOrderComparator::operator()(
return a_priority.IsHigherPriorityThan(b_priority);
}
+bool TileManager::IsReadyToActivate() const {
+ for (std::vector<PictureLayerImpl*>::const_iterator it = layers_.begin();
vmpstr 2014/05/16 00:38:45 This is probably dependent on my patch that clears
reveman 2014/05/16 16:50:13 Yes, we should hold off on this until that lands.
+ it != layers_.end();
+ ++it) {
+ if (!(*it)->AllTilesRequiredForActivationAreReadyToDraw())
+ return false;
+ }
+
+ return true;
+}
+
+void TileManager::ScheduleCheckIfReadyToActivate() {
+ if (check_if_ready_to_activate_pending_)
vmpstr 2014/05/16 00:38:45 As an aside, this pattern seems to be in a few pla
reveman 2014/05/16 16:50:13 Yes, that would be nice and we can probably bake t
+ return;
+
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&TileManager::CheckIfReadyToActivate,
+ weak_ptr_factory_.GetWeakPtr()));
+ check_if_ready_to_activate_pending_ = true;
+}
+
+void TileManager::CheckIfReadyToActivate() {
+ DCHECK(check_if_ready_to_activate_pending_);
+ check_if_ready_to_activate_pending_ = false;
+
+ rasterizer_delegate_->CheckForCompletedTasks();
+ did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
+
+ if (IsReadyToActivate())
+ client_->NotifyReadyToActivate();
+}
+
} // namespace cc
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698