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

Side by Side Diff: cc/tiles/image_controller_unittest.cc

Issue 2749933002: cc: Fix a flake in ImageControllerTest.QueueImageDecodeChangeControllerWithTaskQueued (Closed)
Patch Set: Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/tiles/image_controller.h" 5 #include "cc/tiles/image_controller.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/optional.h" 7 #include "base/optional.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/threading/sequenced_task_runner_handle.h" 10 #include "base/threading/sequenced_task_runner_handle.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // A task that blocks until instructed otherwise. 183 // A task that blocks until instructed otherwise.
184 class BlockingTask : public TileTask { 184 class BlockingTask : public TileTask {
185 public: 185 public:
186 BlockingTask() 186 BlockingTask()
187 : TileTask(true /* supports_concurrent_execution */), run_cv_(&lock_) { 187 : TileTask(true /* supports_concurrent_execution */), run_cv_(&lock_) {
188 EXPECT_TRUE(thread_checker_.CalledOnValidThread()); 188 EXPECT_TRUE(thread_checker_.CalledOnValidThread());
189 } 189 }
190 190
191 void RunOnWorkerThread() override { 191 void RunOnWorkerThread() override {
192 EXPECT_FALSE(HasCompleted()); 192 EXPECT_FALSE(HasCompleted());
193 EXPECT_FALSE(thread_checker_.CalledOnValidThread());
danakj 2017/03/14 21:10:11 You could #if DCHECK_IS_ON() or smoething if u wan
danakj 2017/03/14 21:10:46 You can also use ThreadCheckerImpl if you want
vmpstr 2017/03/15 17:41:57 Good idea. I did ThreadCheckerImpl instead.
194 base::AutoLock hold(lock_); 193 base::AutoLock hold(lock_);
195 if (!can_run_) 194 if (!can_run_)
196 run_cv_.Wait(); 195 run_cv_.Wait();
197 has_run_ = true; 196 has_run_ = true;
198 } 197 }
199 198
200 void OnTaskCompleted() override { 199 void OnTaskCompleted() override {
201 EXPECT_TRUE(thread_checker_.CalledOnValidThread()); 200 EXPECT_TRUE(thread_checker_.CalledOnValidThread());
202 } 201 }
203 202
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 decode_client2.result()); 581 decode_client2.result());
583 582
584 // Reset the controller since the order of destruction is wrong in this test 583 // Reset the controller since the order of destruction is wrong in this test
585 // (|other_cache| should outlive the controller. This is normally done via 584 // (|other_cache| should outlive the controller. This is normally done via
586 // SetImageDecodeCache(nullptr) or it can be done in the dtor of the cache.) 585 // SetImageDecodeCache(nullptr) or it can be done in the dtor of the cache.)
587 ResetController(); 586 ResetController();
588 } 587 }
589 588
590 } // namespace 589 } // namespace
591 } // namespace cc 590 } // 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