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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 900073003: cc: Rework how picture layer tiling set gets into raster queues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 10 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/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 60d3d8db1da2cf062ae28b452ca9b97ee85b833a..842b3480d523bf05301bbc135b323341fd2f5d09 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -78,21 +78,17 @@ class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest {
public:
LayerTreeHostTestReadyToActivateEmpty()
: did_notify_ready_to_activate_(false),
- all_tiles_required_for_activation_are_ready_to_draw_(false),
- required_for_activation_count_(0) {}
+ all_tiles_required_for_activation_are_ready_to_draw_(false) {}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
- const std::vector<PictureLayerImpl*>& layers =
- impl->sync_tree()->picture_layers();
- required_for_activation_count_ = 0;
- for (const auto& layer : layers) {
- FakePictureLayerImpl* fake_layer =
- static_cast<FakePictureLayerImpl*>(layer);
- required_for_activation_count_ +=
- fake_layer->CountTilesRequiredForActivation();
- }
+ bool ready_to_activate_on_commit_complete =
+ impl->tile_manager()->IsReadyToActivate();
+ // This being true means that we have no tiles required for activation
+ // (since we had no time to prepare any tiles if they were required for
+ // activation).
+ EXPECT_TRUE(ready_to_activate_on_commit_complete);
}
void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
@@ -105,22 +101,23 @@ class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest {
void AfterTest() override {
EXPECT_TRUE(did_notify_ready_to_activate_);
EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
- EXPECT_EQ(size_t(0), required_for_activation_count_);
}
- protected:
+ private:
bool did_notify_ready_to_activate_;
bool all_tiles_required_for_activation_are_ready_to_draw_;
- size_t required_for_activation_count_;
};
SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateEmpty);
// Test if the LTHI receives ReadyToActivate notifications from the TileManager
// when some raster tasks flagged as REQUIRED_FOR_ACTIVATION got scheduled.
-class LayerTreeHostTestReadyToActivateNonEmpty
- : public LayerTreeHostTestReadyToActivateEmpty {
+class LayerTreeHostTestReadyToActivateNonEmpty : public LayerTreeHostTest {
public:
+ LayerTreeHostTestReadyToActivateNonEmpty()
+ : did_notify_ready_to_activate_(false),
+ all_tiles_required_for_activation_are_ready_to_draw_(false) {}
+
void SetupTree() override {
client_.set_fill_with_nonsolid_color(true);
scoped_refptr<FakePictureLayer> root_layer =
@@ -132,14 +129,24 @@ class LayerTreeHostTestReadyToActivateNonEmpty
LayerTreeHostTest::SetupTree();
}
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
+ did_notify_ready_to_activate_ = true;
+ all_tiles_required_for_activation_are_ready_to_draw_ =
+ impl->tile_manager()->IsReadyToActivate();
+ EndTest();
+ }
+
void AfterTest() override {
EXPECT_TRUE(did_notify_ready_to_activate_);
EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
- EXPECT_LE(size_t(1), required_for_activation_count_);
}
private:
FakeContentLayerClient client_;
+ bool did_notify_ready_to_activate_;
+ bool all_tiles_required_for_activation_are_ready_to_draw_;
};
SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty);
@@ -150,45 +157,37 @@ class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest {
public:
LayerTreeHostTestReadyToDrawEmpty()
: did_notify_ready_to_draw_(false),
- all_tiles_required_for_draw_are_ready_to_draw_(false),
- required_for_draw_count_(0) {}
+ all_tiles_required_for_draw_are_ready_to_draw_(false) {}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override {
did_notify_ready_to_draw_ = true;
- const std::vector<PictureLayerImpl*>& layers =
- impl->active_tree()->picture_layers();
all_tiles_required_for_draw_are_ready_to_draw_ =
impl->tile_manager()->IsReadyToDraw();
- for (const auto& layer : layers) {
- FakePictureLayerImpl* fake_layer =
- static_cast<FakePictureLayerImpl*>(layer);
- required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw();
- }
-
EndTest();
}
void AfterTest() override {
EXPECT_TRUE(did_notify_ready_to_draw_);
EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
- EXPECT_EQ(size_t(0), required_for_draw_count_);
}
- protected:
+ private:
bool did_notify_ready_to_draw_;
bool all_tiles_required_for_draw_are_ready_to_draw_;
- size_t required_for_draw_count_;
};
SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToDrawEmpty);
// Test if the LTHI receives ReadyToDraw notifications from the TileManager when
// some raster tasks flagged as REQUIRED_FOR_DRAW got scheduled.
-class LayerTreeHostTestReadyToDrawNonEmpty
- : public LayerTreeHostTestReadyToDrawEmpty {
+class LayerTreeHostTestReadyToDrawNonEmpty : public LayerTreeHostTest {
public:
+ LayerTreeHostTestReadyToDrawNonEmpty()
+ : did_notify_ready_to_draw_(false),
+ all_tiles_required_for_draw_are_ready_to_draw_(false) {}
+
void SetupTree() override {
client_.set_fill_with_nonsolid_color(true);
scoped_refptr<FakePictureLayer> root_layer =
@@ -200,14 +199,24 @@ class LayerTreeHostTestReadyToDrawNonEmpty
LayerTreeHostTest::SetupTree();
}
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override {
+ did_notify_ready_to_draw_ = true;
+ all_tiles_required_for_draw_are_ready_to_draw_ =
+ impl->tile_manager()->IsReadyToDraw();
+ EndTest();
+ }
+
void AfterTest() override {
EXPECT_TRUE(did_notify_ready_to_draw_);
EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
- EXPECT_LE(size_t(1), required_for_draw_count_);
}
private:
FakeContentLayerClient client_;
+ bool did_notify_ready_to_draw_;
+ bool all_tiles_required_for_draw_are_ready_to_draw_;
};
// Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in
@@ -5859,7 +5868,7 @@ class GpuRasterizationRasterizesVisibleOnly : public LayerTreeHostTest {
// Verify which tiles got resources using an eviction iterator, which has to
// return all tiles that have resources.
scoped_ptr<EvictionTilePriorityQueue> eviction_queue(
- host_impl->BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES));
+ host_impl->tile_manager()->BuildEvictionQueue());
int tile_count = 0;
for (; !eviction_queue->IsEmpty(); eviction_queue->Pop()) {
Tile* tile = eviction_queue->Top();
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698