diff options
author | ulan@chromium.org <ulan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 10:53:48 +0000 |
---|---|---|
committer | ulan@chromium.org <ulan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-24 10:53:48 +0000 |
commit | 1784b2fff860f2233d946ad5cb4d53c528f61d91 (patch) | |
tree | 6634956be8a4faa794fa6187c6bae347d608b352 /content/renderer/render_thread_impl.h | |
parent | 59da1dfa2de705e75a76b85b7ddf27777859cbfb (diff) | |
download | chromium_src-1784b2fff860f2233d946ad5cb4d53c528f61d91.zip chromium_src-1784b2fff860f2233d946ad5cb4d53c528f61d91.tar.gz chromium_src-1784b2fff860f2233d946ad5cb4d53c528f61d91.tar.bz2 |
Schedule idle handler in the foreground tab based on CPU usage and user activity.
This improves memory usage when the user leaves a tab open for a long time.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8513008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/render_thread_impl.h')
-rw-r--r-- | content/renderer/render_thread_impl.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index b62878d..e35a182 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -42,6 +42,7 @@ class WebStorageEventDispatcher; } namespace base { +class ProcessMetrics; class MessageLoopProxy; class Thread; namespace win { @@ -167,6 +168,11 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // on the renderer's main thread. scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); + // Causes the idle handler to skip sending idle notifications + // on the two next scheduled calls, so idle notifications are + // not sent for at least one notification delay. + void PostponeIdleNotification(); + private: virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; @@ -183,6 +189,8 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, void OnGetAccessibilityTree(); void OnTempCrashWithData(const GURL& data); + void IdleHandlerInForegroundTab(); + // These objects live solely on the render thread. scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_; scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; @@ -217,12 +225,17 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread, // The current value of the idle notification timer delay. int64 idle_notification_delay_in_ms_; + // The number of idle handler calls that skip sending idle notifications. + int idle_notifications_to_skip_; + bool suspend_webkit_shared_timer_; bool notify_webkit_of_modal_loop_; // Timer that periodically calls IdleHandler. base::RepeatingTimer<RenderThreadImpl> idle_timer_; + scoped_ptr<base::ProcessMetrics> process_metrics_; + // The channel from the renderer process to the GPU process. scoped_refptr<GpuChannelHost> gpu_channel_; |