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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 868803002: cc: Change the activation/ready for draw check from layer to queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 for (const auto& layer : layers) { 89 for (const auto& layer : layers) {
90 FakePictureLayerImpl* fake_layer = 90 FakePictureLayerImpl* fake_layer =
91 static_cast<FakePictureLayerImpl*>(layer); 91 static_cast<FakePictureLayerImpl*>(layer);
92 required_for_activation_count_ += 92 required_for_activation_count_ +=
93 fake_layer->CountTilesRequiredForActivation(); 93 fake_layer->CountTilesRequiredForActivation();
94 } 94 }
95 } 95 }
96 96
97 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 97 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
98 did_notify_ready_to_activate_ = true; 98 did_notify_ready_to_activate_ = true;
99 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers(); 99 all_tiles_required_for_activation_are_ready_to_draw_ =
100 all_tiles_required_for_activation_are_ready_to_draw_ = true; 100 impl->tile_manager()->IsReadyToActivate();
101 for (const auto& layer : layers) {
102 if (!layer->AllTilesRequiredForActivationAreReadyToDraw())
103 all_tiles_required_for_activation_are_ready_to_draw_ = false;
104 }
105 EndTest(); 101 EndTest();
106 } 102 }
107 103
108 void AfterTest() override { 104 void AfterTest() override {
109 EXPECT_TRUE(did_notify_ready_to_activate_); 105 EXPECT_TRUE(did_notify_ready_to_activate_);
110 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 106 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
111 EXPECT_EQ(size_t(0), required_for_activation_count_); 107 EXPECT_EQ(size_t(0), required_for_activation_count_);
112 } 108 }
113 109
114 protected: 110 protected:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 LayerTreeHostTestReadyToDrawEmpty() 150 LayerTreeHostTestReadyToDrawEmpty()
155 : did_notify_ready_to_draw_(false), 151 : did_notify_ready_to_draw_(false),
156 all_tiles_required_for_draw_are_ready_to_draw_(false), 152 all_tiles_required_for_draw_are_ready_to_draw_(false),
157 required_for_draw_count_(0) {} 153 required_for_draw_count_(0) {}
158 154
159 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 155 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
160 156
161 void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override { 157 void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override {
162 did_notify_ready_to_draw_ = true; 158 did_notify_ready_to_draw_ = true;
163 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers(); 159 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers();
164 all_tiles_required_for_draw_are_ready_to_draw_ = true; 160 all_tiles_required_for_draw_are_ready_to_draw_ =
161 impl->tile_manager()->IsReadyToDraw();
165 for (const auto& layer : layers) { 162 for (const auto& layer : layers) {
166 if (!layer->AllTilesRequiredForDrawAreReadyToDraw())
167 all_tiles_required_for_draw_are_ready_to_draw_ = false;
168 FakePictureLayerImpl* fake_layer = 163 FakePictureLayerImpl* fake_layer =
169 static_cast<FakePictureLayerImpl*>(layer); 164 static_cast<FakePictureLayerImpl*>(layer);
170 required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw(); 165 required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw();
171 } 166 }
172 167
173 EndTest(); 168 EndTest();
174 } 169 }
175 170
176 void AfterTest() override { 171 void AfterTest() override {
177 EXPECT_TRUE(did_notify_ready_to_draw_); 172 EXPECT_TRUE(did_notify_ready_to_draw_);
(...skipping 6001 matching lines...) Expand 10 before | Expand all | Expand 10 after
6179 6174
6180 void AfterTest() override { EXPECT_TRUE(did_commit_); } 6175 void AfterTest() override { EXPECT_TRUE(did_commit_); }
6181 6176
6182 private: 6177 private:
6183 bool did_commit_; 6178 bool did_commit_;
6184 }; 6179 };
6185 6180
6186 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6181 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6187 6182
6188 } // namespace cc 6183 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698