OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ |
7 | 7 |
8 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" | 8 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" |
9 #include "content/renderer/scheduler/task_queue_manager.h" | 9 #include "content/renderer/scheduler/task_queue_manager.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Must be called from the main thread. | 63 // Must be called from the main thread. |
64 virtual bool IsHighPriorityWorkAnticipated() = 0; | 64 virtual bool IsHighPriorityWorkAnticipated() = 0; |
65 | 65 |
66 // Returns true if there is high priority work pending on the main thread | 66 // Returns true if there is high priority work pending on the main thread |
67 // and the caller should yield to let the scheduler service that work. Note | 67 // and the caller should yield to let the scheduler service that work. Note |
68 // that this is a stricter condition than |IsHighPriorityWorkAnticipated|, | 68 // that this is a stricter condition than |IsHighPriorityWorkAnticipated|, |
69 // restricted to the case where real work is pending. | 69 // restricted to the case where real work is pending. |
70 // Must be called from the main thread. | 70 // Must be called from the main thread. |
71 virtual bool ShouldYieldForHighPriorityWork() = 0; | 71 virtual bool ShouldYieldForHighPriorityWork() = 0; |
72 | 72 |
| 73 // Returns true if a currently running idle task could exceed its deadline |
| 74 // without impacting user experience too much. This should only be used if |
| 75 // there is a task which cannot be pre-empted and is likely to take longer |
| 76 // than the largest expected idle task deadline. It should NOT be polled to |
| 77 // check whether more work can be performed on the current idle task after |
| 78 // its deadline has expired - post a new idle task for the continuation of the |
| 79 // work in this case. |
| 80 // Must be called from the main thread. |
| 81 virtual bool CanExceedIdleDeadlineIfRequired() const = 0; |
| 82 |
73 // Adds or removes a task observer from the scheduler. The observer will be | 83 // Adds or removes a task observer from the scheduler. The observer will be |
74 // notified before and after every executed task. These functions can only be | 84 // notified before and after every executed task. These functions can only be |
75 // called on the main thread. | 85 // called on the main thread. |
76 virtual void AddTaskObserver( | 86 virtual void AddTaskObserver( |
77 base::MessageLoop::TaskObserver* task_observer) = 0; | 87 base::MessageLoop::TaskObserver* task_observer) = 0; |
78 virtual void RemoveTaskObserver( | 88 virtual void RemoveTaskObserver( |
79 base::MessageLoop::TaskObserver* task_observer) = 0; | 89 base::MessageLoop::TaskObserver* task_observer) = 0; |
80 | 90 |
81 // Shuts down the scheduler by dropping any remaining pending work in the work | 91 // Shuts down the scheduler by dropping any remaining pending work in the work |
82 // queues. After this call any work posted to the task runners will be | 92 // queues. After this call any work posted to the task runners will be |
83 // silently dropped. | 93 // silently dropped. |
84 virtual void Shutdown() = 0; | 94 virtual void Shutdown() = 0; |
85 | 95 |
86 protected: | 96 protected: |
87 RendererScheduler(); | 97 RendererScheduler(); |
88 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); | 98 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); |
89 }; | 99 }; |
90 | 100 |
91 } // namespace content | 101 } // namespace content |
92 | 102 |
93 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | 103 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ |
OLD | NEW |