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

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: Created 9 years, 1 month 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 virtual base::SharedMemoryHandle HostAllocateSharedMemoryBuffer( 107 virtual base::SharedMemoryHandle HostAllocateSharedMemoryBuffer(
107 uint32 buffer_size) OVERRIDE; 108 uint32 buffer_size) OVERRIDE;
108 virtual void RegisterExtension(v8::Extension* extension) OVERRIDE; 109 virtual void RegisterExtension(v8::Extension* extension) OVERRIDE;
109 virtual bool IsRegisteredExtension( 110 virtual bool IsRegisteredExtension(
110 const std::string& v8_extension_name) const OVERRIDE; 111 const std::string& v8_extension_name) const OVERRIDE;
111 virtual void ScheduleIdleHandler(int64 initial_delay_ms) OVERRIDE; 112 virtual void ScheduleIdleHandler(int64 initial_delay_ms) OVERRIDE;
112 virtual void IdleHandler() OVERRIDE; 113 virtual void IdleHandler() OVERRIDE;
113 virtual int64 GetIdleNotificationDelayInMs() const OVERRIDE; 114 virtual int64 GetIdleNotificationDelayInMs() const OVERRIDE;
114 virtual void SetIdleNotificationDelayInMs( 115 virtual void SetIdleNotificationDelayInMs(
115 int64 idle_notification_delay_in_ms) OVERRIDE; 116 int64 idle_notification_delay_in_ms) OVERRIDE;
117 virtual void PostponeIdleNotification() OVERRIDE;
116 #if defined(OS_WIN) 118 #if defined(OS_WIN)
117 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE; 119 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
118 virtual void ReleaseCachedFonts() OVERRIDE; 120 virtual void ReleaseCachedFonts() OVERRIDE;
119 #endif 121 #endif
120 122
121 // These methods modify how the next message is sent. Normally, when sending 123 // These methods modify how the next message is sent. Normally, when sending
122 // a synchronous message that runs a nested message loop, we need to suspend 124 // a synchronous message that runs a nested message loop, we need to suspend
123 // callbacks into WebKit. This involves disabling timers and deferring 125 // callbacks into WebKit. This involves disabling timers and deferring
124 // resource loads. However, there are exceptions when we need to customize 126 // resource loads. However, there are exceptions when we need to customize
125 // the behavior. 127 // the behavior.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params); 179 void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params);
178 void OnSetNextPageID(int32 next_page_id); 180 void OnSetNextPageID(int32 next_page_id);
179 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); 181 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors);
180 void OnCreateNewView(const ViewMsg_New_Params& params); 182 void OnCreateNewView(const ViewMsg_New_Params& params);
181 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); 183 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
182 void OnPurgePluginListCache(bool reload_pages); 184 void OnPurgePluginListCache(bool reload_pages);
183 void OnNetworkStateChanged(bool online); 185 void OnNetworkStateChanged(bool online);
184 void OnGetAccessibilityTree(); 186 void OnGetAccessibilityTree();
185 void OnTempCrashWithData(const GURL& data); 187 void OnTempCrashWithData(const GURL& data);
186 188
189 void IdleHandlerInForegroundTab();
190
187 // These objects live solely on the render thread. 191 // These objects live solely on the render thread.
188 scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_; 192 scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_;
189 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; 193 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
190 scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_; 194 scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_;
191 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_; 195 scoped_ptr<RendererWebKitPlatformSupportImpl> webkit_platform_support_;
192 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; 196 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_;
193 197
194 // Used on the renderer and IPC threads. 198 // Used on the renderer and IPC threads.
195 scoped_refptr<DBMessageFilter> db_message_filter_; 199 scoped_refptr<DBMessageFilter> db_message_filter_;
196 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_; 200 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_;
(...skipping 14 matching lines...) Expand all
211 215
212 // The count of RenderWidgets running through this thread. 216 // The count of RenderWidgets running through this thread.
213 int widget_count_; 217 int widget_count_;
214 218
215 // The count of hidden RenderWidgets running through this thread. 219 // The count of hidden RenderWidgets running through this thread.
216 int hidden_widget_count_; 220 int hidden_widget_count_;
217 221
218 // The current value of the idle notification timer delay. 222 // The current value of the idle notification timer delay.
219 int64 idle_notification_delay_in_ms_; 223 int64 idle_notification_delay_in_ms_;
220 224
225 // The number of idle handler calls that skip sending idle notifications.
226 int idle_notifications_to_skip_;
227
221 bool suspend_webkit_shared_timer_; 228 bool suspend_webkit_shared_timer_;
222 bool notify_webkit_of_modal_loop_; 229 bool notify_webkit_of_modal_loop_;
223 230
224 // Timer that periodically calls IdleHandler. 231 // Timer that periodically calls IdleHandler.
225 base::RepeatingTimer<RenderThreadImpl> idle_timer_; 232 base::RepeatingTimer<RenderThreadImpl> idle_timer_;
226 233
234 scoped_ptr<base::ProcessMetrics> process_metrics_;
235
227 // The channel from the renderer process to the GPU process. 236 // The channel from the renderer process to the GPU process.
228 scoped_refptr<GpuChannelHost> gpu_channel_; 237 scoped_refptr<GpuChannelHost> gpu_channel_;
229 238
230 // A lazily initiated thread on which file operations are run. 239 // A lazily initiated thread on which file operations are run.
231 scoped_ptr<base::Thread> file_thread_; 240 scoped_ptr<base::Thread> file_thread_;
232 241
233 // Map of registered v8 extensions. The key is the extension name. 242 // Map of registered v8 extensions. The key is the extension name.
234 std::set<std::string> v8_extensions_; 243 std::set<std::string> v8_extensions_;
235 244
236 scoped_ptr<CompositorThread> compositor_thread_; 245 scoped_ptr<CompositorThread> compositor_thread_;
237 246
238 ObserverList<content::RenderProcessObserver> observers_; 247 ObserverList<content::RenderProcessObserver> observers_;
239 248
240 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); 249 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
241 }; 250 };
242 251
243 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 252 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698