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

Side by Side Diff: content/renderer/render_thread_impl.h

Issue 8513008: Schedule idle handler in the foreground tab based on CPU usage and user activity. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Move PostponeIdleNotification to RenderThreadImpl Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_RENDER_THREAD_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 25 matching lines...) Expand all
36 class SkBitmap; 36 class SkBitmap;
37 class VideoCaptureImplManager; 37 class VideoCaptureImplManager;
38 struct ViewMsg_New_Params; 38 struct ViewMsg_New_Params;
39 class WebDatabaseObserverImpl; 39 class WebDatabaseObserverImpl;
40 40
41 namespace WebKit { 41 namespace WebKit {
42 class WebStorageEventDispatcher; 42 class WebStorageEventDispatcher;
43 } 43 }
44 44
45 namespace base { 45 namespace base {
46 class ProcessMetrics;
46 class MessageLoopProxy; 47 class MessageLoopProxy;
47 class Thread; 48 class Thread;
48 namespace win { 49 namespace win {
49 class ScopedCOMInitializer; 50 class ScopedCOMInitializer;
50 } 51 }
51 } 52 }
52 53
53 namespace content { 54 namespace content {
54 class RenderProcessObserver; 55 class RenderProcessObserver;
55 } 56 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 // Get the GPU channel. Returns NULL if the channel is not established or 163 // Get the GPU channel. Returns NULL if the channel is not established or
163 // has been lost. 164 // has been lost.
164 GpuChannelHost* GetGpuChannel(); 165 GpuChannelHost* GetGpuChannel();
165 166
166 // Returns a MessageLoopProxy instance corresponding to the message loop 167 // Returns a MessageLoopProxy instance corresponding to the message loop
167 // of the thread on which file operations should be run. Must be called 168 // of the thread on which file operations should be run. Must be called
168 // on the renderer's main thread. 169 // on the renderer's main thread.
169 scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); 170 scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy();
170 171
172 // Causes the idle handler to skip sending idle notifications
173 // on the two next scheduled calls, so idle notifications are
174 // not sent for at least one notification delay.
175 void PostponeIdleNotification();
176
171 private: 177 private:
172 virtual bool OnControlMessageReceived(const IPC::Message& msg); 178 virtual bool OnControlMessageReceived(const IPC::Message& msg);
173 179
174 void Init(); 180 void Init();
175 181
176 void OnSetZoomLevelForCurrentURL(const GURL& url, double zoom_level); 182 void OnSetZoomLevelForCurrentURL(const GURL& url, double zoom_level);
177 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params); 183 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params);
178 void OnSetNextPageID(int32 next_page_id); 184 void OnSetNextPageID(int32 next_page_id);
179 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); 185 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors);
180 void OnCreateNewView(const ViewMsg_New_Params& params); 186 void OnCreateNewView(const ViewMsg_New_Params& params);
181 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); 187 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
182 void OnPurgePluginListCache(bool reload_pages); 188 void OnPurgePluginListCache(bool reload_pages);
183 void OnNetworkStateChanged(bool online); 189 void OnNetworkStateChanged(bool online);
184 void OnGetAccessibilityTree(); 190 void OnGetAccessibilityTree();
185 void OnTempCrashWithData(const GURL& data); 191 void OnTempCrashWithData(const GURL& data);
186 192
193 void IdleHandlerInForegroundTab();
194
187 // These objects live solely on the render thread. 195 // These objects live solely on the render thread.
188 scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_; 196 scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_;
189 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; 197 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
190 scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_; 198 scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_;
191 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; 199 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_;
192 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; 200 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_;
193 201
194 // Used on the renderer and IPC threads. 202 // Used on the renderer and IPC threads.
195 scoped_refptr<DBMessageFilter> db_message_filter_; 203 scoped_refptr<DBMessageFilter> db_message_filter_;
196 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_; 204 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_;
(...skipping 14 matching lines...) Expand all
211 219
212 // The count of RenderWidgets running through this thread. 220 // The count of RenderWidgets running through this thread.
213 int widget_count_; 221 int widget_count_;
214 222
215 // The count of hidden RenderWidgets running through this thread. 223 // The count of hidden RenderWidgets running through this thread.
216 int hidden_widget_count_; 224 int hidden_widget_count_;
217 225
218 // The current value of the idle notification timer delay. 226 // The current value of the idle notification timer delay.
219 int64 idle_notification_delay_in_ms_; 227 int64 idle_notification_delay_in_ms_;
220 228
229 // The number of idle handler calls that skip sending idle notifications.
230 int idle_notifications_to_skip_;
231
221 bool suspend_webkit_shared_timer_; 232 bool suspend_webkit_shared_timer_;
222 bool notify_webkit_of_modal_loop_; 233 bool notify_webkit_of_modal_loop_;
223 234
224 // Timer that periodically calls IdleHandler. 235 // Timer that periodically calls IdleHandler.
225 base::RepeatingTimer<RenderThreadImpl> idle_timer_; 236 base::RepeatingTimer<RenderThreadImpl> idle_timer_;
226 237
238 scoped_ptr<base::ProcessMetrics> process_metrics_;
239
227 // The channel from the renderer process to the GPU process. 240 // The channel from the renderer process to the GPU process.
228 scoped_refptr<GpuChannelHost> gpu_channel_; 241 scoped_refptr<GpuChannelHost> gpu_channel_;
229 242
230 // A lazily initiated thread on which file operations are run. 243 // A lazily initiated thread on which file operations are run.
231 scoped_ptr<base::Thread> file_thread_; 244 scoped_ptr<base::Thread> file_thread_;
232 245
233 // Map of registered v8 extensions. The key is the extension name. 246 // Map of registered v8 extensions. The key is the extension name.
234 std::set<std::string> v8_extensions_; 247 std::set<std::string> v8_extensions_;
235 248
236 scoped_ptr<CompositorThread> compositor_thread_; 249 scoped_ptr<CompositorThread> compositor_thread_;
237 250
238 ObserverList<content::RenderProcessObserver> observers_; 251 ObserverList<content::RenderProcessObserver> observers_;
239 252
240 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); 253 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
241 }; 254 };
242 255
243 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 256 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698