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

Unified Diff: cc/test/fake_picture_layer_impl.cc

Issue 672283003: cc: ReadyToDraw notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix counting of required for activation tiles. Created 6 years, 1 month 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/test/fake_picture_layer_impl.h ('k') | cc/test/fake_tile_manager_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_picture_layer_impl.cc
diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
index 07fc5f034454dcfbc098ff049392d1e28bcb95bd..bf55ebf557886e1e351d282b74a75ef940065ecb 100644
--- a/cc/test/fake_picture_layer_impl.cc
+++ b/cc/test/fake_picture_layer_impl.cc
@@ -193,6 +193,65 @@ bool FakePictureLayerImpl::HasValidTilePriorities() const {
: PictureLayerImpl::HasValidTilePriorities();
}
+size_t FakePictureLayerImpl::CountTilesRequired(
+ TileRequirementCheck is_tile_required_callback) const {
+ if (!HasValidTilePriorities())
+ return 0;
+
+ if (!tilings_)
+ return 0;
+
+ if (visible_rect_for_tile_priority_.IsEmpty())
+ return 0;
+
+ gfx::Rect rect = GetViewportForTilePriorityInContentSpace();
+ rect.Intersect(visible_rect_for_tile_priority_);
+
+ size_t count = 0;
+
+ for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
+ PictureLayerTiling* tiling = tilings_->tiling_at(i);
+ if (tiling->resolution() != HIGH_RESOLUTION &&
+ tiling->resolution() != LOW_RESOLUTION)
+ continue;
+
+ for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter;
+ ++iter) {
+ const Tile* tile = *iter;
+ // A null tile (i.e. missing recording) can just be skipped.
+ // TODO(vmpstr): Verify this is true if we create tiles in raster
+ // iterators.
+ if (!tile)
+ continue;
+
+ // We can't check tile->required_for_activation, because that value might
+ // be out of date. It is updated in the raster/eviction iterators.
+ // TODO(vmpstr): Remove the comment once you can't access this information
+ // from the tile.
+ if ((tiling->*is_tile_required_callback)(tile))
+ ++count;
+ }
+ }
+
+ return count;
+}
+
+size_t FakePictureLayerImpl::CountTilesRequiredForActivation() const {
+ if (!layer_tree_impl()->IsPendingTree())
+ return 0;
+
+ return CountTilesRequired(
+ &PictureLayerTiling::IsTileRequiredForActivationIfVisible);
+}
+
+size_t FakePictureLayerImpl::CountTilesRequiredForDraw() const {
+ if (!layer_tree_impl()->IsActiveTree())
+ return 0;
+
+ return CountTilesRequired(
+ &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
+}
+
void FakePictureLayerImpl::ReleaseResources() {
PictureLayerImpl::ReleaseResources();
++release_resources_count_;
« no previous file with comments | « cc/test/fake_picture_layer_impl.h ('k') | cc/test/fake_tile_manager_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698