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

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: comment format Created 5 years, 11 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 for (const auto& layer : layers) { 88 for (const auto& layer : layers) {
89 FakePictureLayerImpl* fake_layer = 89 FakePictureLayerImpl* fake_layer =
90 static_cast<FakePictureLayerImpl*>(layer); 90 static_cast<FakePictureLayerImpl*>(layer);
91 required_for_activation_count_ += 91 required_for_activation_count_ +=
92 fake_layer->CountTilesRequiredForActivation(); 92 fake_layer->CountTilesRequiredForActivation();
93 } 93 }
94 } 94 }
95 95
96 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 96 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
97 did_notify_ready_to_activate_ = true; 97 did_notify_ready_to_activate_ = true;
98 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers(); 98 all_tiles_required_for_activation_are_ready_to_draw_ =
99 all_tiles_required_for_activation_are_ready_to_draw_ = true; 99 impl->tile_manager()->IsReadyToActivate();
100 for (const auto& layer : layers) {
101 if (!layer->AllTilesRequiredForActivationAreReadyToDraw())
102 all_tiles_required_for_activation_are_ready_to_draw_ = false;
103 }
104 EndTest(); 100 EndTest();
105 } 101 }
106 102
107 void AfterTest() override { 103 void AfterTest() override {
108 EXPECT_TRUE(did_notify_ready_to_activate_); 104 EXPECT_TRUE(did_notify_ready_to_activate_);
109 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 105 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
110 EXPECT_EQ(size_t(0), required_for_activation_count_); 106 EXPECT_EQ(size_t(0), required_for_activation_count_);
111 } 107 }
112 108
113 protected: 109 protected:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 LayerTreeHostTestReadyToDrawEmpty() 149 LayerTreeHostTestReadyToDrawEmpty()
154 : did_notify_ready_to_draw_(false), 150 : did_notify_ready_to_draw_(false),
155 all_tiles_required_for_draw_are_ready_to_draw_(false), 151 all_tiles_required_for_draw_are_ready_to_draw_(false),
156 required_for_draw_count_(0) {} 152 required_for_draw_count_(0) {}
157 153
158 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 154 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
159 155
160 void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override { 156 void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override {
161 did_notify_ready_to_draw_ = true; 157 did_notify_ready_to_draw_ = true;
162 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers(); 158 const std::vector<PictureLayerImpl*>& layers = impl->GetPictureLayers();
163 all_tiles_required_for_draw_are_ready_to_draw_ = true; 159 all_tiles_required_for_draw_are_ready_to_draw_ =
160 impl->tile_manager()->IsReadyToDraw();
164 for (const auto& layer : layers) { 161 for (const auto& layer : layers) {
165 if (!layer->AllTilesRequiredForDrawAreReadyToDraw())
166 all_tiles_required_for_draw_are_ready_to_draw_ = false;
167 FakePictureLayerImpl* fake_layer = 162 FakePictureLayerImpl* fake_layer =
168 static_cast<FakePictureLayerImpl*>(layer); 163 static_cast<FakePictureLayerImpl*>(layer);
169 required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw(); 164 required_for_draw_count_ += fake_layer->CountTilesRequiredForDraw();
170 } 165 }
171 166
172 EndTest(); 167 EndTest();
173 } 168 }
174 169
175 void AfterTest() override { 170 void AfterTest() override {
176 EXPECT_TRUE(did_notify_ready_to_draw_); 171 EXPECT_TRUE(did_notify_ready_to_draw_);
(...skipping 5993 matching lines...) Expand 10 before | Expand all | Expand 10 after
6170 6165
6171 void AfterTest() override { EXPECT_TRUE(did_commit_); } 6166 void AfterTest() override { EXPECT_TRUE(did_commit_); }
6172 6167
6173 private: 6168 private:
6174 bool did_commit_; 6169 bool did_commit_;
6175 }; 6170 };
6176 6171
6177 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6172 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6178 6173
6179 } // namespace cc 6174 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.h ('K') | « 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