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

Side by Side Diff: cc/layers/surface_layer_unittest.cc

Issue 834043004: cc: Fix race in SurfaceLayer unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed. 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
« no previous file with comments | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <set> 5 #include <set>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "cc/layers/solid_color_layer.h" 9 #include "cc/layers/solid_color_layer.h"
10 #include "cc/layers/surface_layer.h" 10 #include "cc/layers/surface_layer.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SurfaceSequence expected(1u, 1u); 165 SurfaceSequence expected(1u, 1u);
166 EXPECT_TRUE(required_id_ == SurfaceId(1)); 166 EXPECT_TRUE(required_id_ == SurfaceId(1));
167 EXPECT_EQ(1u, required_set_.size()); 167 EXPECT_EQ(1u, required_set_.size());
168 EXPECT_TRUE(required_set_.count(expected)); 168 EXPECT_TRUE(required_set_.count(expected));
169 169
170 gfx::Size bounds(100, 100); 170 gfx::Size bounds(100, 100);
171 layer_tree_host()->SetViewportSize(bounds); 171 layer_tree_host()->SetViewportSize(bounds);
172 PostSetNeedsCommitToMainThread(); 172 PostSetNeedsCommitToMainThread();
173 } 173 }
174 174
175 void DidCommit() override { 175 void DidCommitAndDrawFrame() override {
176 base::MessageLoopProxy::current()->PostTask( 176 base::MessageLoopProxy::current()->PostTask(
177 FROM_HERE, base::Bind(&SurfaceLayerSwapPromise::ChangeTree, 177 FROM_HERE, base::Bind(&SurfaceLayerSwapPromise::ChangeTree,
178 base::Unretained(this))); 178 base::Unretained(this)));
179 } 179 }
180 180
181 void ChangeTree() { 181 void ChangeTree() {
182 ++commit_count_; 182 ++commit_count_;
183 switch (commit_count_) { 183 switch (commit_count_) {
184 case 1: 184 case 1:
185 // Remove SurfaceLayer from tree to cause SwapPromise to be created. 185 // Remove SurfaceLayer from tree to cause SwapPromise to be created.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 SurfaceId required_id_; 230 SurfaceId required_id_;
231 std::set<SurfaceSequence> required_set_; 231 std::set<SurfaceSequence> required_set_;
232 }; 232 };
233 233
234 // TODO(jbauman): Reenable on single thread once http://crbug.com/421923 is 234 // TODO(jbauman): Reenable on single thread once http://crbug.com/421923 is
235 // fixed. 235 // fixed.
236 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromise); 236 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromise);
237 237
238 } // namespace 238 } // namespace
239 } // namespace cc 239 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698