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

Unified Diff: content/renderer/render_thread_impl.h

Issue 8574012: Schedule idle handler based on CPU usage. (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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_thread_impl.h
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index e3fdac37a5c6174232a56b006338176ff29e7f88..efb71782667a1a39515ec807417f9f39bfde591b 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -43,6 +43,7 @@ class WebStorageEventDispatcher;
}
namespace base {
+class ProcessMetrics;
class MessageLoopProxy;
class Thread;
namespace win {
@@ -108,11 +109,7 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
virtual void RegisterExtension(v8::Extension* extension) OVERRIDE;
virtual bool IsRegisteredExtension(
const std::string& v8_extension_name) const OVERRIDE;
- virtual void ScheduleIdleHandler(int64 initial_delay_ms) OVERRIDE;
- virtual void IdleHandler() OVERRIDE;
- virtual int64 GetIdleNotificationDelayInMs() const OVERRIDE;
- virtual void SetIdleNotificationDelayInMs(
- int64 idle_notification_delay_in_ms) OVERRIDE;
+ virtual void ResetIdleTimer() OVERRIDE;
#if defined(OS_WIN)
virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
virtual void ReleaseCachedFonts() OVERRIDE;
@@ -126,6 +123,8 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
void DoNotSuspendWebKitSharedTimer();
void DoNotNotifyWebKitOfModalLoop();
+ void IdleHandler();
+
// Will be NULL if threaded compositing has not been enabled.
CompositorThread* compositor_thread() const {
return compositor_thread_.get();
@@ -184,6 +183,8 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
void OnGetAccessibilityTree();
void OnTempCrashWithData(const GURL& data);
+ void ScheduleIdleHandler(int64 delay_ms);
+
// These objects live solely on the render thread.
scoped_ptr<ScopedRunnableMethodFactory<RenderThreadImpl> > task_factory_;
scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
@@ -216,14 +217,16 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
int hidden_widget_count_;
// The current value of the idle notification timer delay.
- int64 idle_notification_delay_in_ms_;
+ int64 idle_delay_ms_;
+
+ // Timer that checks CPU usage and calls IdleHandler.
+ base::OneShotTimer<RenderThreadImpl> idle_timer_;
+
+ scoped_ptr<base::ProcessMetrics> process_metrics_;
bool suspend_webkit_shared_timer_;
bool notify_webkit_of_modal_loop_;
- // Timer that periodically calls IdleHandler.
- base::RepeatingTimer<RenderThreadImpl> idle_timer_;
-
// The channel from the renderer process to the GPU process.
scoped_refptr<GpuChannelHost> gpu_channel_;

Powered by Google App Engine
This is Rietveld 408576698