diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 22:12:36 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 22:12:36 +0000 |
commit | 71d6d858d9221d44bd156028ae1478599d95e53a (patch) | |
tree | e26ce5e66444de65e6ee1e68b6a44c898c5391b9 /chrome/renderer/render_thread.h | |
parent | c1c97f3280ba6914bf19ed9cdfdfbf5dc3e29f77 (diff) | |
download | chromium_src-71d6d858d9221d44bd156028ae1478599d95e53a.zip chromium_src-71d6d858d9221d44bd156028ae1478599d95e53a.tar.gz chromium_src-71d6d858d9221d44bd156028ae1478599d95e53a.tar.bz2 |
Hook up V8 idle notifications for extension prcoesses.
We reset the idle timer after any activity, which includes an extension event
or message, or a new extension view being created. The timer runs after 10
seconds of idleness.
BUG=29329
Review URL: http://codereview.chromium.org/460062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.h')
-rw-r--r-- | chrome/renderer/render_thread.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index f5e0d80..8a376aa 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -12,6 +12,8 @@ #include "base/shared_memory.h" #include "base/string16.h" #include "base/task.h" +#include "base/time.h" +#include "base/timer.h" #include "build/build_config.h" #include "chrome/common/child_thread.h" #include "chrome/common/css_colors.h" @@ -125,6 +127,8 @@ class RenderThread : public RenderThreadBase, bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } + bool is_extension_process() const { return is_extension_process_; } + // Do DNS prefetch resolution of a hostname. void Resolve(const char* name, size_t length); @@ -206,6 +210,9 @@ class RenderThread : public RenderThreadBase, // A task we invoke periodically to assist with idle cleanup. void IdleHandler(); + // Schedule a call to IdleHandler with the given initial delay. + void ScheduleIdleHandler(double initial_delay_s); + // These objects live solely on the render thread. scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; scoped_ptr<VisitedLinkSlave> visited_link_slave_; @@ -242,6 +249,16 @@ class RenderThread : public RenderThreadBase, // The current value of the idle notification timer delay. double idle_notification_delay_in_s_; + // True if this renderer is running extensions. + bool is_extension_process_; + + // Timer that periodically calls IdleHandler. + base::RepeatingTimer<RenderThread> idle_timer_; + + // Same as above, but on a longer timer and will run even if the process is + // not idle, to ensure that IdleHandle gets called eventually. + base::RepeatingTimer<RenderThread> forced_idle_timer_; + DISALLOW_COPY_AND_ASSIGN(RenderThread); }; |