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

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

Issue 1223163006: Implement PostDelayedTaskAt for guaranteed timer ordering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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 CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_ 5 #ifndef CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_
6 #define CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_ 6 #define CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "components/scheduler/scheduler_export.h" 11 #include "components/scheduler/scheduler_export.h"
12 #include "third_party/WebKit/public/platform/WebScheduler.h" 12 #include "third_party/WebKit/public/platform/WebScheduler.h"
13 #include "third_party/WebKit/public/platform/WebThread.h" 13 #include "third_party/WebKit/public/platform/WebThread.h"
14 14
15 namespace base { 15 namespace base {
16 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
17 } 17 }
18 18
19 namespace scheduler { 19 namespace scheduler {
20 20
21 class ChildScheduler; 21 class ChildScheduler;
22 class SingleThreadIdleTaskRunner; 22 class SingleThreadIdleTaskRunner;
23 class TaskQueue;
23 24
24 class SCHEDULER_EXPORT WebSchedulerImpl : public blink::WebScheduler { 25 class SCHEDULER_EXPORT WebSchedulerImpl : public blink::WebScheduler {
25 public: 26 public:
26 WebSchedulerImpl( 27 WebSchedulerImpl(
27 ChildScheduler* child_scheduler, 28 ChildScheduler* child_scheduler,
28 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner, 29 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner,
29 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, 30 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
30 scoped_refptr<base::SingleThreadTaskRunner> timer_task_runner); 31 scoped_refptr<TaskQueue> timer_task_runner);
31 ~WebSchedulerImpl() override; 32 ~WebSchedulerImpl() override;
32 33
33 // blink::WebScheduler implementation: 34 // blink::WebScheduler implementation:
34 virtual void shutdown(); 35 virtual void shutdown();
35 virtual bool shouldYieldForHighPriorityWork(); 36 virtual bool shouldYieldForHighPriorityWork();
36 virtual bool canExceedIdleDeadlineIfRequired(); 37 virtual bool canExceedIdleDeadlineIfRequired();
37 virtual void postIdleTask(const blink::WebTraceLocation& location, 38 virtual void postIdleTask(const blink::WebTraceLocation& location,
38 blink::WebThread::IdleTask* task); 39 blink::WebThread::IdleTask* task);
39 virtual void postNonNestableIdleTask(const blink::WebTraceLocation& location, 40 virtual void postNonNestableIdleTask(const blink::WebTraceLocation& location,
40 blink::WebThread::IdleTask* task); 41 blink::WebThread::IdleTask* task);
41 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation& location, 42 virtual void postIdleTaskAfterWakeup(const blink::WebTraceLocation& location,
42 blink::WebThread::IdleTask* task); 43 blink::WebThread::IdleTask* task);
43 virtual void postLoadingTask(const blink::WebTraceLocation& location, 44 virtual void postLoadingTask(const blink::WebTraceLocation& location,
44 blink::WebThread::Task* task); 45 blink::WebThread::Task* task);
46 virtual void postTimerTaskAt(const blink::WebTraceLocation& location,
47 blink::WebThread::Task* task,
48 double monotonicTime);
alex clarke (OOO till 29th) 2015/07/16 09:29:00 Is monotonicTime the right name for this parameter
Sami 2015/07/16 12:19:32 I did some grepping and that's what most of Blink
49
50 // TODO(skyostil): Remove once the Blink side patch lands.
45 virtual void postTimerTask(const blink::WebTraceLocation& location, 51 virtual void postTimerTask(const blink::WebTraceLocation& location,
46 blink::WebThread::Task* task, 52 blink::WebThread::Task* task,
47 long long delayMs); 53 long long delayMs);
48 54
49 private: 55 private:
50 static void runIdleTask(scoped_ptr<blink::WebThread::IdleTask> task, 56 static void runIdleTask(scoped_ptr<blink::WebThread::IdleTask> task,
51 base::TimeTicks deadline); 57 base::TimeTicks deadline);
52 static void runTask(scoped_ptr<blink::WebThread::Task> task); 58 static void runTask(scoped_ptr<blink::WebThread::Task> task);
53 59
54 ChildScheduler* child_scheduler_; // NOT OWNED 60 ChildScheduler* child_scheduler_; // NOT OWNED
55 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; 61 scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
56 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_; 62 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner_;
57 scoped_refptr<base::SingleThreadTaskRunner> timer_task_runner_; 63 scoped_refptr<TaskQueue> timer_task_runner_;
58 }; 64 };
59 65
60 } // namespace scheduler 66 } // namespace scheduler
61 67
62 #endif // CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_ 68 #endif // CONTENT_CHILD_SCHEDULER_BASE_WEB_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698