 Chromium Code Reviews
 Chromium Code Reviews Issue 1424053002:
  Adds a flag to support "Virtual Time" to the blink scheduler  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1424053002:
  Adds a flag to support "Virtual Time" to the blink scheduler  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: components/scheduler/child/virtual_time_task_runner_delegate_impl.h | 
| diff --git a/components/scheduler/child/scheduler_task_runner_delegate_impl.h b/components/scheduler/child/virtual_time_task_runner_delegate_impl.h | 
| similarity index 54% | 
| copy from components/scheduler/child/scheduler_task_runner_delegate_impl.h | 
| copy to components/scheduler/child/virtual_time_task_runner_delegate_impl.h | 
| index 2f18b992c68728bbdd47c47a32e3bbf9c128098e..deed976099c687ca0e8ce233cdd8c824e780f2ba 100644 | 
| --- a/components/scheduler/child/scheduler_task_runner_delegate_impl.h | 
| +++ b/components/scheduler/child/virtual_time_task_runner_delegate_impl.h | 
| @@ -2,21 +2,26 @@ | 
| // Use of this source code is governed by a BSD-style license that can be | 
| // found in the LICENSE file. | 
| -#ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 
| -#define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 
| +#ifndef COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TASK_RUNNER_DELEGATE_IMPL_H_ | 
| +#define COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TASK_RUNNER_DELEGATE_IMPL_H_ | 
| +#include <map> | 
| + | 
| +#include "base/macros.h" | 
| #include "base/message_loop/message_loop.h" | 
| +#include "base/time/tick_clock.h" | 
| #include "components/scheduler/child/scheduler_task_runner_delegate.h" | 
| #include "components/scheduler/scheduler_export.h" | 
| namespace scheduler { | 
| -class SCHEDULER_EXPORT SchedulerTaskRunnerDelegateImpl | 
| +class SCHEDULER_EXPORT VirtualTimeTaskRunnerDelegateImpl | 
| : public SchedulerTaskRunnerDelegate { | 
| public: | 
| // |message_loop| is not owned and must outlive the lifetime of this object. | 
| - static scoped_refptr<SchedulerTaskRunnerDelegateImpl> Create( | 
| - base::MessageLoop* message_loop); | 
| + static scoped_refptr<VirtualTimeTaskRunnerDelegateImpl> Create( | 
| + base::MessageLoop* message_loop, | 
| + base::TimeTicks initial_now); | 
| // SchedulerTaskRunnerDelegate implementation | 
| void SetDefaultTaskRunner( | 
| @@ -30,20 +35,33 @@ class SCHEDULER_EXPORT SchedulerTaskRunnerDelegateImpl | 
| base::TimeDelta delay) override; | 
| bool RunsTasksOnCurrentThread() const override; | 
| bool IsNested() const override; | 
| + base::TimeTicks NowTicks() override; | 
| + void OnNoMoreWork() override; | 
| + | 
| + void SetFastForwardTimers(bool fast_forward_timers); | 
| 
Sami
2015/10/28 20:00:35
nit: "Timers" aren't really a thing at this level.
 
alex clarke (OOO till 29th)
2015/10/29 18:07:30
Yeah looks like this isn't needed anymore.
 | 
| protected: | 
| - ~SchedulerTaskRunnerDelegateImpl() override; | 
| + ~VirtualTimeTaskRunnerDelegateImpl() override; | 
| private: | 
| - explicit SchedulerTaskRunnerDelegateImpl(base::MessageLoop* message_loop); | 
| + VirtualTimeTaskRunnerDelegateImpl(base::MessageLoop* message_loop, | 
| + base::TimeTicks initial_no); | 
| + | 
| + void AdvancedTimeTo(base::TimeTicks now); | 
| + | 
| + typedef std::multimap<base::TimeTicks, base::Closure> DelayedWakeupMultimap; | 
| + | 
| + DelayedWakeupMultimap delayed_wakeup_multimap_; | 
| // Not owned. | 
| base::MessageLoop* message_loop_; | 
| scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_; | 
| + base::TimeTicks now_; | 
| + bool bool fast_forward_timers_; | 
| 
Sami
2015/10/28 20:00:35
typo: double bool (didn't realize this even compil
 
alex clarke (OOO till 29th)
2015/10/29 18:07:30
Done.
 | 
| - DISALLOW_COPY_AND_ASSIGN(SchedulerTaskRunnerDelegateImpl); | 
| + DISALLOW_COPY_AND_ASSIGN(VirtualTimeTaskRunnerDelegateImpl); | 
| }; | 
| } // namespace scheduler | 
| -#endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_TASK_RUNNER_DELEGATE_IMPL_H_ | 
| +#endif // COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TASK_RUNNER_DELEGATE_IMPL_H_ |