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

Unified Diff: content/renderer/render_thread_impl.h

Issue 2668663002: Purge memory before suspending timer queues when backgrounded. (Closed)
Patch Set: Remove mainThreadOnly's timer_queue_suspended_when_backgrounded Created 3 years, 11 months 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
« no previous file with comments | « no previous file | content/renderer/render_thread_impl.cc » ('j') | content/renderer/render_thread_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.h
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 1506ecf06f0346a10c7415cde00d725604a34303..910c9fd559ff915485fdda6c5aeb56fec6cc9c47 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -517,6 +517,9 @@ class CONTENT_EXPORT RenderThreadImpl
void RecordAction(const base::UserMetricsAction& action) override;
void RecordComputedAction(const std::string& action) override;
+ void PurgeBeforeSuspendTimerQueue();
+ void SuspendTimerQueueWhenBackgrounded();
+
bool IsMainThread();
// base::MemoryCoordinatorClient implementation:
@@ -763,6 +766,14 @@ class CONTENT_EXPORT RenderThreadImpl
scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>
thread_safe_render_message_filter_;
+ // The amount of time to wait before suspending shared timers after the
+ // renderer has been backgrounded. This is used only if background suspension
+ // of shared timers is enabled.
+ static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000;
+
+ base::CancelableClosure purge_before_suspend_timers_closure_;
+ base::CancelableClosure suspend_timers_when_backgrounded_closure_;
+
base::CancelableClosure record_purge_suspend_metric_closure_;
RendererMemoryMetrics purge_and_suspend_memory_metrics_;
base::CancelableClosure record_purge_suspend_growth_metric_closure_;
« no previous file with comments | « no previous file | content/renderer/render_thread_impl.cc » ('j') | content/renderer/render_thread_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698