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

Side by Side Diff: cc/test/scheduler_test_common.cc

Issue 17362002: cc: Remove FakeThread, use SingleThreadTaskRunner in scheduling classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-fakethread: rebase Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/trees/layer_tree_host_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/test/scheduler_test_common.h" 5 #include "cc/test/scheduler_test_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 void FakeTimeSourceClient::OnTimerTick() { tick_called_ = true; } 11 void FakeTimeSourceClient::OnTimerTick() { tick_called_ = true; }
12 12
13 FakeThread::FakeThread() { Reset(); }
14
15 FakeThread::~FakeThread() {}
16
17 void FakeThread::RunPendingTask() {
18 ASSERT_TRUE(pending_task_);
19 scoped_ptr<base::Closure> task = pending_task_.Pass();
20 task->Run();
21 }
22
23 void FakeThread::PostTask(base::Closure cb) {
24 PostDelayedTask(cb, base::TimeDelta());
25 }
26
27 void FakeThread::PostDelayedTask(base::Closure cb, base::TimeDelta delay) {
28 if (run_pending_task_on_overwrite_ && HasPendingTask())
29 RunPendingTask();
30
31 ASSERT_FALSE(HasPendingTask());
32 pending_task_.reset(new base::Closure(cb));
33 pending_task_delay_ = delay.InMilliseconds();
34 }
35
36 bool FakeThread::BelongsToCurrentThread() const { return true; }
37
38 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 13 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
39 14
40 } // namespace cc 15 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698