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

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

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: Added a test 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 #ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ 5 #ifndef COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_
6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ 6 #define COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_
7 7
8 #include "base/time/tick_clock.h"
8 #include "components/scheduler/base/task_queue_manager.h" 9 #include "components/scheduler/base/task_queue_manager.h"
9 #include "components/scheduler/base/task_queue_selector.h" 10 #include "components/scheduler/base/task_queue_selector.h"
10 #include "components/scheduler/scheduler_export.h" 11 #include "components/scheduler/scheduler_export.h"
11 12
12 namespace base { 13 namespace base {
13 class TickClock; 14 class TickClock;
14 } 15 }
15 16
16 namespace scheduler { 17 namespace scheduler {
17 18
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual void OnUnregisterTaskQueue( 75 virtual void OnUnregisterTaskQueue(
75 const scoped_refptr<TaskQueue>& queue) = 0; 76 const scoped_refptr<TaskQueue>& queue) = 0;
76 }; 77 };
77 78
78 // Called once to set the Observer. This function is called on the main 79 // Called once to set the Observer. This function is called on the main
79 // thread. If |observer| is null, then no callbacks will occur. 80 // thread. If |observer| is null, then no callbacks will occur.
80 // Note |observer| is expected to outlive the SchedulerHelper. 81 // Note |observer| is expected to outlive the SchedulerHelper.
81 void SetObserver(Observer* observer); 82 void SetObserver(Observer* observer);
82 83
83 // Accessor methods. 84 // Accessor methods.
85 base::TickClock* tick_clock() const;
84 base::TimeTicks Now() const; 86 base::TimeTicks Now() const;
Sami 2015/10/28 20:00:35 This looks redundant now.
alex clarke (OOO till 29th) 2015/10/29 18:23:13 Done.
85 base::TimeTicks NextPendingDelayedTaskRunTime() const; 87 base::TimeTicks NextPendingDelayedTaskRunTime() const;
86 bool GetAndClearSystemIsQuiescentBit(); 88 bool GetAndClearSystemIsQuiescentBit();
87 89
88 // Test helpers. 90 // Test helpers.
89 void SetTimeSourceForTesting(scoped_ptr<base::TickClock> time_source);
90 void SetWorkBatchSizeForTesting(size_t work_batch_size); 91 void SetWorkBatchSizeForTesting(size_t work_batch_size);
91 TaskQueueManager* GetTaskQueueManagerForTesting(); 92 TaskQueueManager* GetTaskQueueManagerForTesting();
92 93
93 private: 94 private:
94 friend class SchedulerHelperTest; 95 friend class SchedulerHelperTest;
95 96
96 base::ThreadChecker thread_checker_; 97 base::ThreadChecker thread_checker_;
97 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_; 98 scoped_refptr<SchedulerTaskRunnerDelegate> main_task_runner_;
98 scoped_ptr<TaskQueueManager> task_queue_manager_; 99 scoped_ptr<TaskQueueManager> task_queue_manager_;
99 scoped_refptr<TaskQueue> control_task_runner_; 100 scoped_refptr<TaskQueue> control_task_runner_;
100 scoped_refptr<TaskQueue> control_after_wakeup_task_runner_; 101 scoped_refptr<TaskQueue> control_after_wakeup_task_runner_;
101 scoped_refptr<TaskQueue> default_task_runner_; 102 scoped_refptr<TaskQueue> default_task_runner_;
102 103
103 scoped_ptr<base::TickClock> time_source_;
104
105 Observer* observer_; // NOT OWNED 104 Observer* observer_; // NOT OWNED
106 const char* tracing_category_; 105 const char* tracing_category_;
107 const char* disabled_by_default_tracing_category_; 106 const char* disabled_by_default_tracing_category_;
108 107
109 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); 108 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper);
110 }; 109 };
111 110
112 } // namespace scheduler 111 } // namespace scheduler
113 112
114 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ 113 #endif // COMPONENTS_SCHEDULER_CHILD_SCHEDULER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698