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

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

Powered by Google App Engine
This is Rietveld 408576698