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

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

Issue 1133143003: [Android] Suspend shared timers for hidden renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_remove_suspend
Patch Set: Move logic to the scheduler Created 5 years, 3 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 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // process have been hidden. The renderer is assumed to be visible when the 72 // process have been hidden. The renderer is assumed to be visible when the
73 // scheduler is constructed. Must be called on the main thread. 73 // scheduler is constructed. Must be called on the main thread.
74 virtual void OnRendererHidden() = 0; 74 virtual void OnRendererHidden() = 0;
75 75
76 // Tells the scheduler that at least one render widget managed by this 76 // Tells the scheduler that at least one render widget managed by this
77 // renderer process has become visible and the renderer is no longer hidden. 77 // renderer process has become visible and the renderer is no longer hidden.
78 // The renderer is assumed to be visible when the scheduler is constructed. 78 // The renderer is assumed to be visible when the scheduler is constructed.
79 // Must be called on the main thread. 79 // Must be called on the main thread.
80 virtual void OnRendererVisible() = 0; 80 virtual void OnRendererVisible() = 0;
81 81
82 // Tells the scheduler that the renderer process has been backgrounded, i.e.,
83 // there are no critical, user facing activities (visual, audio, etc...)
84 // driven by this process. A stricter condition than |OnRendererHidden()|, the
85 // process is assumed to be foregrounded when the scheduler is constructed.
86 // Must be called on the main thread.
87 virtual void OnRendererBackgrounded() = 0;
88
89 // Tells the scheduler that the renderer process has been foregrounded.
90 // This is the assumed state when the scheduler is constructed.
91 // Must be called on the main thread.
92 virtual void OnRendererForegrounded() = 0;
93
82 // Tells the scheduler that a page load has started. The scheduler will 94 // Tells the scheduler that a page load has started. The scheduler will
83 // prioritize loading tasks for a short duration afterwards. 95 // prioritize loading tasks for a short duration afterwards.
84 // Must be called from the main thread. 96 // Must be called from the main thread.
85 virtual void OnPageLoadStarted() = 0; 97 virtual void OnPageLoadStarted() = 0;
86 98
87 // Returns true if the scheduler has reason to believe that high priority work 99 // Returns true if the scheduler has reason to believe that high priority work
88 // may soon arrive on the main thread, e.g., if gesture events were observed 100 // may soon arrive on the main thread, e.g., if gesture events were observed
89 // recently. 101 // recently.
90 // Must be called from the main thread. 102 // Must be called from the main thread.
91 virtual bool IsHighPriorityWorkAnticipated() = 0; 103 virtual bool IsHighPriorityWorkAnticipated() = 0;
92 104
93 // Suspends the timer queue and increments the timer queue suspension count. 105 // Suspends the timer queue and increments the timer queue suspension count.
94 // May only be called from the main thread. 106 // May only be called from the main thread.
95 virtual void SuspendTimerQueue() = 0; 107 virtual void SuspendTimerQueue() = 0;
96 108
97 // Decrements the timer queue suspension count and re-enables the timer queue 109 // Decrements the timer queue suspension count and re-enables the timer queue
98 // if the suspension count is zero and the current schduler policy allows it. 110 // if the suspension count is zero and the current schduler policy allows it.
99 virtual void ResumeTimerQueue() = 0; 111 virtual void ResumeTimerQueue() = 0;
100 112
101 protected: 113 protected:
102 RendererScheduler(); 114 RendererScheduler();
103 DISALLOW_COPY_AND_ASSIGN(RendererScheduler); 115 DISALLOW_COPY_AND_ASSIGN(RendererScheduler);
104 }; 116 };
105 117
106 } // namespace scheduler 118 } // namespace scheduler
107 119
108 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_ 120 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDERER_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698