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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.cc

Issue 2326313003: Revert of Make canceling Timers fast. (Closed)
Patch Set: Created 4 years, 3 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
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 "platform/scheduler/test/fake_web_task_runner.h" 5 #include "platform/scheduler/test/fake_web_task_runner.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "wtf/RefCounted.h" 8 #include "wtf/RefCounted.h"
9 9
10 namespace blink { 10 namespace blink {
11 namespace scheduler { 11 namespace scheduler {
12 12
13 class FakeWebTaskRunner::Data : public WTF::ThreadSafeRefCounted<Data> { 13 class FakeWebTaskRunner::Data : public WTF::ThreadSafeRefCounted<Data> {
14 public: 14 public:
15 Data() : time_(0.0) {} 15 Data() : time_(0.0) {}
16 16
17 std::unique_ptr<Task> task_; 17 std::unique_ptr<Task> task_;
18 base::Closure closure_;
19 double time_; 18 double time_;
20 19
21 private: 20 private:
22 ~Data() {} 21 ~Data() {}
23 22
24 friend ThreadSafeRefCounted<Data>; 23 friend ThreadSafeRefCounted<Data>;
25 DISALLOW_COPY_AND_ASSIGN(Data); 24 DISALLOW_COPY_AND_ASSIGN(Data);
26 }; 25 };
27 26
28 FakeWebTaskRunner::FakeWebTaskRunner() : data_(adoptRef(new Data)) {} 27 FakeWebTaskRunner::FakeWebTaskRunner() : data_(adoptRef(new Data)) {}
(...skipping 12 matching lines...) Expand all
41 void FakeWebTaskRunner::postTask(const WebTraceLocation&, Task*) { 40 void FakeWebTaskRunner::postTask(const WebTraceLocation&, Task*) {
42 NOTREACHED(); 41 NOTREACHED();
43 } 42 }
44 43
45 void FakeWebTaskRunner::postDelayedTask(const WebTraceLocation&, 44 void FakeWebTaskRunner::postDelayedTask(const WebTraceLocation&,
46 Task* task, 45 Task* task,
47 double) { 46 double) {
48 data_->task_.reset(task); 47 data_->task_.reset(task);
49 } 48 }
50 49
51 void FakeWebTaskRunner::postDelayedTask(const WebTraceLocation&,
52 const base::Closure& closure,
53 double) {
54 data_->closure_ = closure;
55 }
56
57 bool FakeWebTaskRunner::runsTasksOnCurrentThread() { 50 bool FakeWebTaskRunner::runsTasksOnCurrentThread() {
58 return true; 51 return true;
59 } 52 }
60 53
61 std::unique_ptr<WebTaskRunner> FakeWebTaskRunner::clone() { 54 std::unique_ptr<WebTaskRunner> FakeWebTaskRunner::clone() {
62 return WTF::wrapUnique(new FakeWebTaskRunner(data_)); 55 return WTF::wrapUnique(new FakeWebTaskRunner(data_));
63 } 56 }
64 57
65 double FakeWebTaskRunner::virtualTimeSeconds() const { 58 double FakeWebTaskRunner::virtualTimeSeconds() const {
66 return data_->time_; 59 return data_->time_;
67 } 60 }
68 61
69 double FakeWebTaskRunner::monotonicallyIncreasingVirtualTimeSeconds() const { 62 double FakeWebTaskRunner::monotonicallyIncreasingVirtualTimeSeconds() const {
70 return data_->time_; 63 return data_->time_;
71 } 64 }
72 65
73 SingleThreadTaskRunner* FakeWebTaskRunner::toSingleThreadTaskRunner() { 66 SingleThreadTaskRunner* FakeWebTaskRunner::toSingleThreadTaskRunner() {
74 NOTREACHED(); 67 NOTREACHED();
75 return nullptr; 68 return nullptr;
76 } 69 }
77 70
78 } // namespace scheduler 71 } // namespace scheduler
79 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scheduler/test/fake_web_task_runner.h ('k') | third_party/WebKit/Source/web/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698