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 // 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 |
| 75 // called on the main thread. |
| 76 virtual void AddTaskObserver( |
| 77 base::MessageLoop::TaskObserver* task_observer) = 0; |
| 78 virtual void RemoveTaskObserver( |
| 79 base::MessageLoop::TaskObserver* task_observer) = 0; |
| 80 |
73 // Shuts down the scheduler by dropping any remaining pending work in the work | 81 // Shuts down the scheduler by dropping any remaining pending work in the work |
74 // queues. After this call any work posted to the task runners will be | 82 // queues. After this call any work posted to the task runners will be |
75 // silently dropped. | 83 // silently dropped. |
76 virtual void Shutdown() = 0; | 84 virtual void Shutdown() = 0; |
77 | 85 |
78 protected: | 86 protected: |
79 RendererScheduler(); | 87 RendererScheduler(); |
80 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); | 88 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); |
81 }; | 89 }; |
82 | 90 |
83 } // namespace content | 91 } // namespace content |
84 | 92 |
85 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ | 93 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_H_ |
OLD | NEW |