summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvmpstr <vmpstr@chromium.org>2015-06-04 12:25:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-04 19:26:48 +0000
commit0ba15defa7aeb2ae64a3b25fdbe1a0c10bca69b5 (patch)
tree03e60279f899c02f193d458014022cee764774ef
parent0222e845fc4670a6fb06a224383da4b4f6419e5a (diff)
downloadchromium_src-0ba15defa7aeb2ae64a3b25fdbe1a0c10bca69b5.zip
chromium_src-0ba15defa7aeb2ae64a3b25fdbe1a0c10bca69b5.tar.gz
chromium_src-0ba15defa7aeb2ae64a3b25fdbe1a0c10bca69b5.tar.bz2
cc: Expose HasValidTilePriorities via picture layer tiling client.
This patch removes GetMaxTilePriorityBin in favor of exposing HasValidTilePriorities directly. Although, initially we thought GetMaxTilePriorityBin was a nicer abstraction, this makes it difficult to separate layer knowledge from raster iterators (they check whether layers have valid tile priorities). This patch allows tiling sets to be passed to the raster iterators and the equivalent check to be performed via tiling client. R=danakj, enne CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1154263002 Cr-Commit-Position: refs/heads/master@{#332875}
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc4
-rw-r--r--cc/layers/picture_layer_impl.cc6
-rw-r--r--cc/layers/picture_layer_impl.h4
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc9
-rw-r--r--cc/test/fake_picture_layer_tiling_client.h8
-rw-r--r--cc/tiles/picture_layer_tiling.cc5
-rw-r--r--cc/tiles/picture_layer_tiling.h2
7 files changed, 15 insertions, 23 deletions
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index 8f8a71d..9a9d241 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -91,8 +91,8 @@ class FixedInvalidationPictureLayerTilingClient
return base_client_->GetPendingOrActiveTwinTiling(tiling);
}
- TilePriority::PriorityBin GetMaxTilePriorityBin() const override {
- return base_client_->GetMaxTilePriorityBin();
+ bool HasValidTilePriorities() const override {
+ return base_client_->HasValidTilePriorities();
}
bool RequiresHighResToDraw() const override {
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index c6c8d66..88cf1fb 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -650,12 +650,6 @@ const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling(
return twin_layer->tilings_->FindTilingWithScale(tiling->contents_scale());
}
-TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const {
- if (!HasValidTilePriorities())
- return TilePriority::EVENTUALLY;
- return TilePriority::NOW;
-}
-
bool PictureLayerImpl::RequiresHighResToDraw() const {
return layer_tree_impl()->RequiresHighResToDraw();
}
diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h
index 119b0d4..a23dbba 100644
--- a/cc/layers/picture_layer_impl.h
+++ b/cc/layers/picture_layer_impl.h
@@ -61,7 +61,7 @@ class CC_EXPORT PictureLayerImpl
const Region* GetPendingInvalidation() override;
const PictureLayerTiling* GetPendingOrActiveTwinTiling(
const PictureLayerTiling* tiling) const override;
- TilePriority::PriorityBin GetMaxTilePriorityBin() const override;
+ bool HasValidTilePriorities() const override;
bool RequiresHighResToDraw() const override;
gfx::Rect GetEnclosingRectInTargetSpace() const override;
@@ -93,8 +93,6 @@ class CC_EXPORT PictureLayerImpl
// Functions used by tile manager.
PictureLayerImpl* GetPendingOrActiveTwinLayer() const;
bool IsOnActiveOrPendingTree() const;
- // Virtual for testing.
- virtual bool HasValidTilePriorities() const;
// Used for benchmarking
RasterSource* GetRasterSource() const { return raster_source_.get(); }
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index 75eff0c..bba8459 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -16,7 +16,7 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient()
pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
twin_set_(nullptr),
twin_tiling_(nullptr),
- max_tile_priority_bin_(TilePriority::NOW) {
+ has_valid_tile_priorities_(true) {
}
FakePictureLayerTilingClient::FakePictureLayerTilingClient(
@@ -27,7 +27,7 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient(
pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
twin_set_(nullptr),
twin_tiling_(nullptr),
- max_tile_priority_bin_(TilePriority::NOW) {
+ has_valid_tile_priorities_(true) {
}
FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
@@ -47,9 +47,8 @@ gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
return tile_size_;
}
-TilePriority::PriorityBin FakePictureLayerTilingClient::GetMaxTilePriorityBin()
- const {
- return max_tile_priority_bin_;
+bool FakePictureLayerTilingClient::HasValidTilePriorities() const {
+ return has_valid_tile_priorities_;
}
const Region* FakePictureLayerTilingClient::GetPendingInvalidation() {
diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h
index 82a6ff8..a49e2a1 100644
--- a/cc/test/fake_picture_layer_tiling_client.h
+++ b/cc/test/fake_picture_layer_tiling_client.h
@@ -24,7 +24,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
ScopedTilePtr CreateTile(float contents_scale,
const gfx::Rect& rect) override;
gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
- TilePriority::PriorityBin GetMaxTilePriorityBin() const override;
+ bool HasValidTilePriorities() const override;
void SetTileSize(const gfx::Size& tile_size);
gfx::Size TileSize() const { return tile_size_; }
@@ -44,8 +44,8 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
}
void set_text_rect(const gfx::Rect& rect) { text_rect_ = rect; }
void set_invalidation(const Region& region) { invalidation_ = region; }
- void set_max_tile_priority_bin(TilePriority::PriorityBin bin) {
- max_tile_priority_bin_ = bin;
+ void set_has_valid_tile_priorities(bool has_valid_tile_priorities) {
+ has_valid_tile_priorities_ = has_valid_tile_priorities;
}
RasterSource* raster_source() { return pile_.get(); }
@@ -63,7 +63,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
PictureLayerTiling* twin_tiling_;
gfx::Rect text_rect_;
Region invalidation_;
- TilePriority::PriorityBin max_tile_priority_bin_;
+ bool has_valid_tile_priorities_;
};
} // namespace cc
diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc
index df6085d..3c22a4f 100644
--- a/cc/tiles/picture_layer_tiling.cc
+++ b/cc/tiles/picture_layer_tiling.cc
@@ -877,8 +877,9 @@ TilePriority PictureLayerTiling::ComputePriorityForTile(
DCHECK_EQ(ComputePriorityRectTypeForTile(tile), priority_rect_type);
DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile);
- TilePriority::PriorityBin priority_bin = client_->GetMaxTilePriorityBin();
-
+ TilePriority::PriorityBin priority_bin = client_->HasValidTilePriorities()
+ ? TilePriority::NOW
+ : TilePriority::EVENTUALLY;
switch (priority_rect_type) {
case VISIBLE_RECT:
return TilePriority(resolution_, priority_bin, 0);
diff --git a/cc/tiles/picture_layer_tiling.h b/cc/tiles/picture_layer_tiling.h
index c5ed5bd..717b8a8 100644
--- a/cc/tiles/picture_layer_tiling.h
+++ b/cc/tiles/picture_layer_tiling.h
@@ -45,7 +45,7 @@ class CC_EXPORT PictureLayerTilingClient {
virtual const Region* GetPendingInvalidation() = 0;
virtual const PictureLayerTiling* GetPendingOrActiveTwinTiling(
const PictureLayerTiling* tiling) const = 0;
- virtual TilePriority::PriorityBin GetMaxTilePriorityBin() const = 0;
+ virtual bool HasValidTilePriorities() const = 0;
virtual bool RequiresHighResToDraw() const = 0;
protected: