summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 16:55:42 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 16:55:42 +0000
commit42f14bfcf12a0f25a37805027f4a25d99ccff297 (patch)
treed7c97531cfc404842ea1f8c6945789a2022dcc2f /cc/test
parentc7d7c12ffa6810ab1c1a063af244cef6d6c49f49 (diff)
downloadchromium_src-42f14bfcf12a0f25a37805027f4a25d99ccff297.zip
chromium_src-42f14bfcf12a0f25a37805027f4a25d99ccff297.tar.gz
chromium_src-42f14bfcf12a0f25a37805027f4a25d99ccff297.tar.bz2
cc: Simplify picture layer tiling update tile priorities.
This patch simplifies the priority math calculation and moves it into layers space. This makes the priority to be less correct, since we're inverse transforming the viewport into layer space instead of forward transforming tiles into screen space in all cases. In particular, with perspective and rotated layers, we will be marking more tiles as visible than before. This should be OK, since the amount of those layers in practice is limited. BUG=339142 Review URL: https://codereview.chromium.org/140513006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/fake_picture_layer_impl.cc4
-rw-r--r--cc/test/fake_picture_layer_tiling_client.cc22
-rw-r--r--cc/test/fake_picture_layer_tiling_client.h15
-rw-r--r--cc/test/test_tile_priorities.cc8
4 files changed, 41 insertions, 8 deletions
diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
index 4241ae0..6ff4012 100644
--- a/cc/test/fake_picture_layer_impl.cc
+++ b/cc/test/fake_picture_layer_impl.cc
@@ -82,8 +82,8 @@ void FakePictureLayerImpl::SetAllTilesVisible() {
Tile* tile = tiles[tile_idx];
TilePriority priority;
priority.resolution = HIGH_RESOLUTION;
- priority.time_to_visible_in_seconds = 0.f;
- priority.distance_to_visible_in_pixels = 0.f;
+ priority.priority_bin = TilePriority::NOW;
+ priority.distance_to_visible = 0.f;
tile->SetPriority(tree, priority);
}
}
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc
index f891b9e..36d1eee 100644
--- a/cc/test/fake_picture_layer_tiling_client.cc
+++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -27,7 +27,10 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient()
: tile_manager_(new FakeTileManager(&tile_manager_client_)),
pile_(new FakeInfinitePicturePileImpl()),
twin_tiling_(NULL),
- allow_create_tile_(true) {}
+ allow_create_tile_(true),
+ max_tiles_for_interest_area_(10000),
+ skewport_target_time_in_seconds_(1.0f),
+ skewport_extrapolation_limit_in_content_pixels_(2000) {}
FakePictureLayerTilingClient::FakePictureLayerTilingClient(
ResourceProvider* resource_provider)
@@ -35,7 +38,9 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient(
new FakeTileManager(&tile_manager_client_, resource_provider)),
pile_(new FakeInfinitePicturePileImpl()),
twin_tiling_(NULL),
- allow_create_tile_(true) {}
+ allow_create_tile_(true),
+ max_tiles_for_interest_area_(10000),
+ skewport_target_time_in_seconds_(1.0f) {}
FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
}
@@ -58,6 +63,19 @@ gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
return tile_size_;
}
+size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
+ return max_tiles_for_interest_area_;
+}
+
+float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
+ return skewport_target_time_in_seconds_;
+}
+
+int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
+ const {
+ return skewport_extrapolation_limit_in_content_pixels_;
+}
+
const Region* FakePictureLayerTilingClient::GetInvalidation() {
return &invalidation_;
}
diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h
index 6383a22..5989bba 100644
--- a/cc/test/fake_picture_layer_tiling_client.h
+++ b/cc/test/fake_picture_layer_tiling_client.h
@@ -26,6 +26,9 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
virtual void UpdatePile(Tile* tile) OVERRIDE {}
virtual gfx::Size CalculateTileSize(
const gfx::Size& content_bounds) const OVERRIDE;
+ virtual size_t GetMaxTilesForInterestArea() const OVERRIDE;
+ virtual float GetSkewportTargetTimeInSeconds() const OVERRIDE;
+ virtual int GetSkewportExtrapolationLimitInContentPixels() const OVERRIDE;
void SetTileSize(const gfx::Size& tile_size);
gfx::Size TileSize() const { return tile_size_; }
@@ -40,6 +43,15 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
void set_text_rect(const gfx::Rect& rect) { text_rect_ = rect; }
void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; }
void set_invalidation(const Region& region) { invalidation_ = region; }
+ void set_max_tiles_for_interest_area(size_t area) {
+ max_tiles_for_interest_area_ = area;
+ }
+ void set_skewport_target_time_in_seconds(float time) {
+ skewport_target_time_in_seconds_ = time;
+ }
+ void set_skewport_extrapolation_limit_in_content_pixels(int limit) {
+ skewport_extrapolation_limit_in_content_pixels_ = limit;
+ }
TileManager* tile_manager() const {
return tile_manager_.get();
@@ -54,6 +66,9 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
gfx::Rect text_rect_;
bool allow_create_tile_;
Region invalidation_;
+ size_t max_tiles_for_interest_area_;
+ float skewport_target_time_in_seconds_;
+ int skewport_extrapolation_limit_in_content_pixels_;
};
} // namespace cc
diff --git a/cc/test/test_tile_priorities.cc b/cc/test/test_tile_priorities.cc
index 9d3aae2..9f644d3 100644
--- a/cc/test/test_tile_priorities.cc
+++ b/cc/test/test_tile_priorities.cc
@@ -7,16 +7,16 @@
namespace cc {
TilePriorityForSoonBin::TilePriorityForSoonBin()
- : TilePriority(HIGH_RESOLUTION, 0.5, 300.0) {}
+ : TilePriority(HIGH_RESOLUTION, SOON, 300.0) {}
TilePriorityForEventualBin::TilePriorityForEventualBin()
- : TilePriority(HIGH_RESOLUTION, 2.0, 315.0) {}
+ : TilePriority(HIGH_RESOLUTION, EVENTUALLY, 315.0) {}
TilePriorityForNowBin::TilePriorityForNowBin()
- : TilePriority(HIGH_RESOLUTION, 0, 0) {}
+ : TilePriority(HIGH_RESOLUTION, NOW, 0) {}
TilePriorityRequiredForActivation::TilePriorityRequiredForActivation()
- : TilePriority(HIGH_RESOLUTION, 0, 0) {
+ : TilePriority(HIGH_RESOLUTION, NOW, 0) {
required_for_activation = true;
}