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

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: 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
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 void FakeTimeSource::SetClient(TimeSourceClient* client) { client_ = client; } 13 void FakeTimeSource::SetClient(TimeSourceClient* client) { client_ = client; }
39 14
40 void FakeTimeSource::SetActive(bool b) { active_ = b; } 15 void FakeTimeSource::SetActive(bool b) { active_ = b; }
41 16
42 bool FakeTimeSource::Active() const { return active_; } 17 bool FakeTimeSource::Active() const { return active_; }
43 18
44 base::TimeTicks FakeTimeSource::LastTickTime() { return base::TimeTicks(); } 19 base::TimeTicks FakeTimeSource::LastTickTime() { return base::TimeTicks(); }
45 20
46 base::TimeTicks FakeTimeSource::NextTickTime() { return base::TimeTicks(); } 21 base::TimeTicks FakeTimeSource::NextTickTime() { return base::TimeTicks(); }
47 22
48 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; } 23 base::TimeTicks FakeDelayBasedTimeSource::Now() const { return now_; }
49 24
50 } // namespace cc 25 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698