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

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

Issue 2266443002: Optimize posting of WTF::Closure and improve scheduler test mocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cut back to just the WTF::Closure fix plus the scheduler test mock refactor. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_TEST_FAKE_WEB_TASK_RUNNER_H _
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_TEST_FAKE_WEB_TASK_RUNNER_H _
7
8 #include "base/macros.h"
9 #include "public/platform/WebTaskRunner.h"
10
11 namespace blink {
12 namespace scheduler {
13
14 // A dummy WebTaskRunner for tests.
15 class FakeWebTaskRunner : public WebTaskRunner {
16 public:
17 FakeWebTaskRunner();
18 ~FakeWebTaskRunner() override;
19
20 void setTime(double new_time);
21
22 // WebTaskRunner implementation:
23 void postTask(const WebTraceLocation&, Task*) override;
24 void postDelayedTask(const WebTraceLocation&, Task*, double) override;
25 bool runsTasksOnCurrentThread() override;
26 std::unique_ptr<WebTaskRunner> clone() override;
27 double virtualTimeSeconds() const override;
28 double monotonicallyIncreasingVirtualTimeSeconds() const override;
29 SingleThreadTaskRunner* toSingleThreadTaskRunner() override;
30
31 private:
32 std::unique_ptr<Task> task_;
33 double time_;
34
35 DISALLOW_COPY_AND_ASSIGN(FakeWebTaskRunner);
36 };
37
38 } // namespace scheduler
39 } // namespace blink
40
41 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_TEST_FAKE_WEB_TASK_RUNNE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698