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

Side by Side Diff: components/scheduler/base/task_queue.h

Issue 2155143002: Fix a bug that could occasionaly cause setInterval to stop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ClearExpiredWakeups tweak. Created 4 years, 5 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
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_BASE_TASK_QUEUE_H_ 5 #ifndef COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_
6 #define COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ 6 #define COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "components/scheduler/scheduler_export.h" 12 #include "components/scheduler/scheduler_export.h"
13 13
14 namespace base { 14 namespace base {
15 namespace trace_event { 15 namespace trace_event {
16 class BlameContext; 16 class BlameContext;
17 } 17 }
18 } 18 }
19 19
20 namespace scheduler { 20 namespace scheduler {
21 class LazyNow;
21 class TimeDomain; 22 class TimeDomain;
22 23
23 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner { 24 class SCHEDULER_EXPORT TaskQueue : public base::SingleThreadTaskRunner {
24 public: 25 public:
25 TaskQueue() {} 26 TaskQueue() {}
26 27
27 // Unregisters the task queue after which no tasks posted to it will run and 28 // Unregisters the task queue after which no tasks posted to it will run and
28 // the TaskQueueManager's reference to it will be released soon. 29 // the TaskQueueManager's reference to it will be released soon.
29 virtual void UnregisterTaskQueue() = 0; 30 virtual void UnregisterTaskQueue() = 0;
30 31
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // that the tasks in the work queue, if any, are scheduled for execution. 176 // that the tasks in the work queue, if any, are scheduled for execution.
176 // 177 //
177 // This function only needs to be called if automatic pumping is disabled. 178 // This function only needs to be called if automatic pumping is disabled.
178 // By default automatic pumping is enabled for all queues. NOTE this must be 179 // By default automatic pumping is enabled for all queues. NOTE this must be
179 // called on the thread this TaskQueue was created by. 180 // called on the thread this TaskQueue was created by.
180 // 181 //
181 // The |may_post_dowork| parameter controls whether or not PumpQueue calls 182 // The |may_post_dowork| parameter controls whether or not PumpQueue calls
182 // TaskQueueManager::MaybeScheduleImmediateWork. 183 // TaskQueueManager::MaybeScheduleImmediateWork.
183 // TODO(alexclarke): Add a base::RunLoop observer so we can get rid of 184 // TODO(alexclarke): Add a base::RunLoop observer so we can get rid of
184 // |may_post_dowork|. 185 // |may_post_dowork|.
185 virtual void PumpQueue(bool may_post_dowork) = 0; 186 virtual void PumpQueue(LazyNow* lazy_now, bool may_post_dowork) = 0;
186 187
187 // These functions can only be called on the same thread that the task queue 188 // These functions can only be called on the same thread that the task queue
188 // manager executes its tasks on. 189 // manager executes its tasks on.
189 virtual void AddTaskObserver( 190 virtual void AddTaskObserver(
190 base::MessageLoop::TaskObserver* task_observer) = 0; 191 base::MessageLoop::TaskObserver* task_observer) = 0;
191 virtual void RemoveTaskObserver( 192 virtual void RemoveTaskObserver(
192 base::MessageLoop::TaskObserver* task_observer) = 0; 193 base::MessageLoop::TaskObserver* task_observer) = 0;
193 194
194 // Set the blame context which is entered and left while executing tasks from 195 // Set the blame context which is entered and left while executing tasks from
195 // this task queue. |blame_context| must be null or outlive this task queue. 196 // this task queue. |blame_context| must be null or outlive this task queue.
(...skipping 10 matching lines...) Expand all
206 207
207 protected: 208 protected:
208 ~TaskQueue() override {} 209 ~TaskQueue() override {}
209 210
210 DISALLOW_COPY_AND_ASSIGN(TaskQueue); 211 DISALLOW_COPY_AND_ASSIGN(TaskQueue);
211 }; 212 };
212 213
213 } // namespace scheduler 214 } // namespace scheduler
214 215
215 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_ 216 #endif // COMPONENTS_SCHEDULER_BASE_TASK_QUEUE_H_
OLDNEW
« no previous file with comments | « components/scheduler/base/real_time_domain.cc ('k') | components/scheduler/base/task_queue_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698