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

Side by Side Diff: components/scheduler/renderer/renderer_scheduler.h

Issue 1368643002: Add a signal to the scheduler that a navigation is expected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: We do need ref counts! There can be multiple concurrent navigations. Created 5 years, 2 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
« no previous file with comments | « no previous file | components/scheduler/renderer/renderer_scheduler_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 NavigationTaskPendingIncRef() = 0;
Sami 2015/09/25 16:18:38 nit: I think the "reference" part here is a little
alex clarke (OOO till 29th) 2015/09/25 16:57:38 Done.
121
122 // Tells the scheduler that a navigation task is no longer pending.
123 // Must be called on the main thread.
124 virtual void NavigationTaskPendingDecRef() = 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_
OLDNEW
« no previous file with comments | « no previous file | components/scheduler/renderer/renderer_scheduler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698