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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2595813002: Disable PurgeAndSuspend when MemoryCoordinator is enabled. (Closed)
Patch Set: Created 4 years 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 | 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 2e4e4b991ebb35670a623fa92773c18fb8386908..797ab1c16b2baba724345b74c63f37e6424c5163 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1778,10 +1778,17 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
ChildThreadImpl::OnProcessPurgeAndSuspend();
if (!RendererIsHidden())
return;
+
+ // Disable PurgeAndSuspend and not record UMA to avoid conflicting
+ // MemoryCoordinator finch experiment when MemoryCoordinator is enabled.
haraken 2016/12/21 04:03:23 Just say: TODO(bashi): Enable the tab suspension
tasak 2016/12/22 04:49:52 Done.
+ if (base::FeatureList::IsEnabled(features::kMemoryCoordinator))
bashi 2016/12/21 08:44:02 Why do we need this guard? Isn't having a guard in
tasak 2016/12/21 08:49:31 To avoid invoking record_purge_suspend_metric_clos
bashi 2016/12/21 08:55:32 How about calling PostDelayedTask() in SuspendRend
tasak 2016/12/21 08:58:28 To enable A/B testing, the PostDelayedTask is also
bashi 2016/12/21 09:02:41 OK
+ return;
+
if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) {
- // TODO(tasak,bashi): After enabling MemoryCoordinator, stop calling
- // SuspendRenderer() here.
- SuspendRenderer();
+ // TODO(tasak): After enabling MemoryCoordinator, remove this Notify
+ // and follow MemoryCoordinator's request.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(
+ base::MemoryState::SUSPENDED);
}
// 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
@@ -1888,10 +1895,17 @@ void RenderThreadImpl::OnProcessResume() {
if (!RendererIsHidden())
return;
+
+ // Disable PurgeAndSuspend and not record UMA to avoid conflicting
+ // MemoryCoordinator finch experiment when MemoryCoordinator is enabled.
haraken 2016/12/21 04:03:23 Ditto.
tasak 2016/12/22 04:49:52 Done.
+ if (base::FeatureList::IsEnabled(features::kMemoryCoordinator))
+ return;
+
if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) {
- // TODO(tasak,bashi): After enabling MemoryCoordinator, stop calling
- // ResumeRenderer() here.
- ResumeRenderer();
+ // TODO(tasak): after enabling MemoryCoordinator, remove this Notify
+ // and follow MemoryCoordinator's request.
+ base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(
+ base::MemoryState::NORMAL);
}
}
@@ -2258,10 +2272,10 @@ void RenderThreadImpl::OnMemoryStateChange(base::MemoryState state) {
}
switch (state) {
case base::MemoryState::NORMAL:
- // TODO(bashi): When the renderer is suspended, resume it.
+ ResumeRenderer();
break;
case base::MemoryState::THROTTLED:
- // TODO(bashi): When the renderer is suspended, resume it.
+ ResumeRenderer();
// TODO(bashi): Figure out what kind of strategy is suitable on
// THROTTLED state. crbug.com/674815
#if defined(OS_ANDROID)
@@ -2273,10 +2287,7 @@ void RenderThreadImpl::OnMemoryStateChange(base::MemoryState state) {
ReleaseFreeMemory();
break;
case base::MemoryState::SUSPENDED:
- // TODO(bashi): Suspend the renderer.
- OnTrimMemoryImmediately();
- ReleaseFreeMemory();
- ClearMemory();
+ SuspendRenderer();
break;
case base::MemoryState::UNKNOWN:
NOTREACHED();
@@ -2289,12 +2300,18 @@ void RenderThreadImpl::SuspendRenderer() {
OnTrimMemoryImmediately();
ReleaseFreeMemory();
ClearMemory();
- renderer_scheduler_->SuspendRenderer();
+ // When only PurgeAndSuspend is enabled, suspend blink scheduler.
haraken 2016/12/21 04:03:23 Ditto.
tasak 2016/12/22 04:49:52 Done.
+ if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator) &&
+ base::FeatureList::IsEnabled(features::kPurgeAndSuspend))
+ renderer_scheduler_->SuspendRenderer();
}
void RenderThreadImpl::ResumeRenderer() {
DCHECK(IsMainThread());
- renderer_scheduler_->ResumeRenderer();
+ // When only PurgeAndSuspend is enabled, resume blink scheduler.
haraken 2016/12/21 04:03:23 Ditto.
tasak 2016/12/22 04:49:52 Done.
+ if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator) &&
+ base::FeatureList::IsEnabled(features::kPurgeAndSuspend))
+ renderer_scheduler_->ResumeRenderer();
}
void RenderThreadImpl::ClearMemory() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698