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

Side by Side Diff: components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc

Issue 1424053002: Adds a flag to support "Virtual Time" to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes ts.h" 5 #include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tes ts.h"
6 6
7 #include "base/time/default_tick_clock.h"
8
7 namespace scheduler { 9 namespace scheduler {
8 10
9 // static 11 // static
10 scoped_refptr<LazySchedulerMessageLoopDelegateForTests> 12 scoped_refptr<LazySchedulerMessageLoopDelegateForTests>
11 LazySchedulerMessageLoopDelegateForTests::Create() { 13 LazySchedulerMessageLoopDelegateForTests::Create() {
12 return make_scoped_refptr(new LazySchedulerMessageLoopDelegateForTests()); 14 return make_scoped_refptr(new LazySchedulerMessageLoopDelegateForTests());
13 } 15 }
14 16
15 LazySchedulerMessageLoopDelegateForTests:: 17 LazySchedulerMessageLoopDelegateForTests::
16 LazySchedulerMessageLoopDelegateForTests() 18 LazySchedulerMessageLoopDelegateForTests()
17 : message_loop_(base::MessageLoop::current()), 19 : message_loop_(base::MessageLoop::current()),
18 thread_id_(base::PlatformThread::CurrentId()) { 20 thread_id_(base::PlatformThread::CurrentId()),
21 time_source_(make_scoped_ptr(new base::DefaultTickClock())) {
19 if (message_loop_) 22 if (message_loop_)
20 original_task_runner_ = message_loop_->task_runner(); 23 original_task_runner_ = message_loop_->task_runner();
21 } 24 }
22 25
23 LazySchedulerMessageLoopDelegateForTests:: 26 LazySchedulerMessageLoopDelegateForTests::
24 ~LazySchedulerMessageLoopDelegateForTests() { 27 ~LazySchedulerMessageLoopDelegateForTests() {
25 RestoreDefaultTaskRunner(); 28 RestoreDefaultTaskRunner();
26 } 29 }
27 30
28 base::MessageLoop* LazySchedulerMessageLoopDelegateForTests::EnsureMessageLoop() 31 base::MessageLoop* LazySchedulerMessageLoopDelegateForTests::EnsureMessageLoop()
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 78
76 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread() 79 bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread()
77 const { 80 const {
78 return thread_id_ == base::PlatformThread::CurrentId(); 81 return thread_id_ == base::PlatformThread::CurrentId();
79 } 82 }
80 83
81 bool LazySchedulerMessageLoopDelegateForTests::IsNested() const { 84 bool LazySchedulerMessageLoopDelegateForTests::IsNested() const {
82 return EnsureMessageLoop()->IsNested(); 85 return EnsureMessageLoop()->IsNested();
83 } 86 }
84 87
88 base::TimeTicks LazySchedulerMessageLoopDelegateForTests::NowTicks() {
89 return time_source_->NowTicks();
90 }
91
92 void LazySchedulerMessageLoopDelegateForTests::OnNoMoreImmediateWork() {}
93
85 } // namespace scheduler 94 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698