| 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 COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "components/scheduler/child/child_scheduler.h" | 9 #include "components/scheduler/child/child_scheduler.h" |
| 10 #include "components/scheduler/child/single_thread_idle_task_runner.h" | 10 #include "components/scheduler/child/single_thread_idle_task_runner.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // driven by this process. A stricter condition than |OnRendererHidden()|, the | 107 // driven by this process. A stricter condition than |OnRendererHidden()|, the |
| 108 // process is assumed to be foregrounded when the scheduler is constructed. | 108 // process is assumed to be foregrounded when the scheduler is constructed. |
| 109 // Must be called on the main thread. | 109 // Must be called on the main thread. |
| 110 virtual void OnRendererBackgrounded() = 0; | 110 virtual void OnRendererBackgrounded() = 0; |
| 111 | 111 |
| 112 // Tells the scheduler that the renderer process has been foregrounded. | 112 // Tells the scheduler that the renderer process has been foregrounded. |
| 113 // This is the assumed state when the scheduler is constructed. | 113 // This is the assumed state when the scheduler is constructed. |
| 114 // Must be called on the main thread. | 114 // Must be called on the main thread. |
| 115 virtual void OnRendererForegrounded() = 0; | 115 virtual void OnRendererForegrounded() = 0; |
| 116 | 116 |
| 117 // Tells the scheduler that a page load has started. The scheduler will | 117 // Tells the scheduler that a navigation task is pending. While any navigation |
| 118 // tasks are pending, the scheduler will ensure that loading tasks are not |
| 119 // blocked even if they are expensive. Must be called on the main thread. |
| 120 virtual void AddPendingNavigation() = 0; |
| 121 |
| 122 // Tells the scheduler that a navigation task is no longer pending. |
| 123 // Must be called on the main thread. |
| 124 virtual void RemovePendingNavigation() = 0; |
| 125 |
| 126 // Tells the scheduler that a navigation has started. The scheduler will |
| 118 // prioritize loading tasks for a short duration afterwards. | 127 // prioritize loading tasks for a short duration afterwards. |
| 119 // Must be called from the main thread. | 128 // Must be called from the main thread. |
| 120 virtual void OnPageLoadStarted() = 0; | 129 virtual void OnNavigationStarted() = 0; |
| 121 | 130 |
| 122 // Returns true if the scheduler has reason to believe that high priority work | 131 // Returns true if the scheduler has reason to believe that high priority work |
| 123 // may soon arrive on the main thread, e.g., if gesture events were observed | 132 // may soon arrive on the main thread, e.g., if gesture events were observed |
| 124 // recently. | 133 // recently. |
| 125 // Must be called from the main thread. | 134 // Must be called from the main thread. |
| 126 virtual bool IsHighPriorityWorkAnticipated() = 0; | 135 virtual bool IsHighPriorityWorkAnticipated() = 0; |
| 127 | 136 |
| 128 // Suspends the timer queue and increments the timer queue suspension count. | 137 // Suspends the timer queue and increments the timer queue suspension count. |
| 129 // May only be called from the main thread. | 138 // May only be called from the main thread. |
| 130 virtual void SuspendTimerQueue() = 0; | 139 virtual void SuspendTimerQueue() = 0; |
| 131 | 140 |
| 132 // Decrements the timer queue suspension count and re-enables the timer queue | 141 // Decrements the timer queue suspension count and re-enables the timer queue |
| 133 // if the suspension count is zero and the current schduler policy allows it. | 142 // if the suspension count is zero and the current schduler policy allows it. |
| 134 virtual void ResumeTimerQueue() = 0; | 143 virtual void ResumeTimerQueue() = 0; |
| 135 | 144 |
| 136 // Sets whether to allow suspension of timers after the backgrounded signal is | 145 // Sets whether to allow suspension of timers after the backgrounded signal is |
| 137 // received via OnRendererBackgrounded. Defaults to disabled. | 146 // received via OnRendererBackgrounded. Defaults to disabled. |
| 138 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0; | 147 virtual void SetTimerQueueSuspensionWhenBackgroundedEnabled(bool enabled) = 0; |
| 139 | 148 |
| 140 protected: | 149 protected: |
| 141 RendererScheduler(); | 150 RendererScheduler(); |
| 142 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); | 151 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 } // namespace scheduler | 154 } // namespace scheduler |
| 146 | 155 |
| 147 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ | 156 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ |
| OLD | NEW |