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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2529833002: Move suspend logic into OnMemoryStateChange() (Closed)
Patch Set: Don't record UMA Created 4 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 5426e8aa67a192bfd5a4f6cd25242ab1ecd53418..6de8aae0a00b4e404b08a89342d9c3a952f2b2d4 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1778,9 +1778,7 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
// and follow MemoryCoordinator's request.
base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(
base::MemoryState::SUSPENDED);
- renderer_scheduler_->SuspendRenderer();
}
-
// Since purging is not a synchronous task (e.g. v8 GC, oilpan GC, ...),
// we need to wait until the task is finished. So wait 15 seconds and
// update purge+suspend UMA histogram.
@@ -2289,9 +2287,7 @@ void RenderThreadImpl::OnMemoryStateChange(base::MemoryState state) {
ReleaseFreeMemory();
break;
case base::MemoryState::SUSPENDED:
- OnTrimMemoryImmediately();
- ReleaseFreeMemory();
- ClearMemory();
+ SuspendRenderer();
break;
case base::MemoryState::UNKNOWN:
NOTREACHED();
@@ -2299,6 +2295,13 @@ void RenderThreadImpl::OnMemoryStateChange(base::MemoryState state) {
}
}
+void RenderThreadImpl::SuspendRenderer() {
+ OnTrimMemoryImmediately();
+ ReleaseFreeMemory();
+ ClearMemory();
+ renderer_scheduler_->SuspendRenderer();
+}
+
void RenderThreadImpl::ClearMemory() {
// Do not call into blink if it is not initialized.
if (blink_platform_impl_) {
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698