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

Side by Side Diff: components/scheduler/child/virtual_time_tqm_delegate.h

Issue 1652083002: Prepare for per-webview virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 10 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 2015 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 COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TQM_DELEGATE_H_
6 #define COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TQM_DELEGATE_H_
7
8 #include <map>
9
10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/time/tick_clock.h"
13 #include "components/scheduler/child/scheduler_tqm_delegate.h"
14 #include "components/scheduler/scheduler_export.h"
15
16 namespace scheduler {
17
18 class SCHEDULER_EXPORT VirtualTimeTqmDelegate : public SchedulerTqmDelegate {
19 public:
20 // |message_loop| is not owned and must outlive the lifetime of this object.
21 static scoped_refptr<VirtualTimeTqmDelegate> Create(
22 base::MessageLoop* message_loop,
23 base::TimeTicks initial_now);
24
25 // SchedulerTqmDelegate implementation
26 void SetDefaultTaskRunner(
27 scoped_refptr<base::SingleThreadTaskRunner> task_runner) override;
28 void RestoreDefaultTaskRunner() override;
29 bool PostDelayedTask(const tracked_objects::Location& from_here,
30 const base::Closure& task,
31 base::TimeDelta delay) override;
32 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
33 const base::Closure& task,
34 base::TimeDelta delay) override;
35 bool RunsTasksOnCurrentThread() const override;
36 bool IsNested() const override;
37 base::TimeTicks NowTicks() override;
38 void OnNoMoreImmediateWork() override;
39 double CurrentTimeSeconds() const override;
40
41 protected:
42 ~VirtualTimeTqmDelegate() override;
43
44 private:
45 explicit VirtualTimeTqmDelegate(base::MessageLoop* message_loop,
46 base::TimeTicks initial_no);
47
48 void AdvancedTimeTo(base::TimeTicks now);
49
50 typedef std::multimap<base::TimeTicks, base::Closure> DelayedWakeupMultimap;
51
52 DelayedWakeupMultimap delayed_wakeup_multimap_;
53
54 // Not owned.
55 base::MessageLoop* message_loop_;
56 scoped_refptr<SingleThreadTaskRunner> message_loop_task_runner_;
57 base::TimeTicks now_;
58
59 DISALLOW_COPY_AND_ASSIGN(VirtualTimeTqmDelegate);
60 };
61
62 } // namespace scheduler
63
64 #endif // COMPONENTS_SCHEDULER_CHILD_VIRTUAL_TIME_TQM_DELEGATE_H_
OLDNEW
« no previous file with comments | « components/scheduler/child/scheduler_tqm_delegate_impl.cc ('k') | components/scheduler/child/virtual_time_tqm_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698