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

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

Issue 873473006: cc: Commit directly to active tree when using single thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: committoactive: smallerdiff 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') | cc/trees/layer_tree_host_unittest_picture.cc » ('j') | 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void AfterTest() override { 135 void AfterTest() override {
136 EXPECT_TRUE(did_notify_ready_to_activate_); 136 EXPECT_TRUE(did_notify_ready_to_activate_);
137 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 137 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
138 EXPECT_LE(size_t(1), required_for_activation_count_); 138 EXPECT_LE(size_t(1), required_for_activation_count_);
139 } 139 }
140 140
141 private: 141 private:
142 FakeContentLayerClient client_; 142 FakeContentLayerClient client_;
143 }; 143 };
144 144
145 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); 145 // Multi-thread only because in single thread the commit goes directly to the
146 // active tree, so notify ready to activate is skipped.
147 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty);
146 148
147 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 149 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
148 // no raster tasks get scheduled. 150 // no raster tasks get scheduled.
149 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { 151 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest {
150 public: 152 public:
151 LayerTreeHostTestReadyToDrawEmpty() 153 LayerTreeHostTestReadyToDrawEmpty()
152 : did_notify_ready_to_draw_(false), 154 : did_notify_ready_to_draw_(false),
153 all_tiles_required_for_draw_are_ready_to_draw_(false), 155 all_tiles_required_for_draw_are_ready_to_draw_(false),
154 required_for_draw_count_(0) {} 156 required_for_draw_count_(0) {}
155 157
(...skipping 5036 matching lines...) Expand 10 before | Expand all | Expand 10 after
5192 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); 5194 EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
5193 // Veto will take effect when layers are updated. 5195 // Veto will take effect when layers are updated.
5194 // The results will be verified after commit is completed below. 5196 // The results will be verified after commit is completed below.
5195 // Since we are manually marking picture pile as unsuitable, 5197 // Since we are manually marking picture pile as unsuitable,
5196 // make sure that the layer gets a chance to update. 5198 // make sure that the layer gets a chance to update.
5197 layer->SetNeedsDisplay(); 5199 layer->SetNeedsDisplay();
5198 PostSetNeedsCommitToMainThread(); 5200 PostSetNeedsCommitToMainThread();
5199 } 5201 }
5200 5202
5201 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 5203 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
5202 EXPECT_TRUE(host_impl->pending_tree()->use_gpu_rasterization()); 5204 EXPECT_TRUE(host_impl->sync_tree()->use_gpu_rasterization());
5203 EXPECT_TRUE(host_impl->use_gpu_rasterization()); 5205 EXPECT_TRUE(host_impl->use_gpu_rasterization());
5204 } 5206 }
5205 5207
5206 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 5208 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
5207 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization()); 5209 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization());
5208 EXPECT_TRUE(host_impl->use_gpu_rasterization()); 5210 EXPECT_TRUE(host_impl->use_gpu_rasterization());
5209 EndTest(); 5211 EndTest();
5210 } 5212 }
5211 5213
5212 void AfterTest() override {} 5214 void AfterTest() override {}
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
6312 6314
6313 void AfterTest() override { EXPECT_TRUE(did_commit_); } 6315 void AfterTest() override { EXPECT_TRUE(did_commit_); }
6314 6316
6315 private: 6317 private:
6316 bool did_commit_; 6318 bool did_commit_;
6317 }; 6319 };
6318 6320
6319 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); 6321 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit);
6320 6322
6321 } // namespace cc 6323 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698