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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2595813002: Disable PurgeAndSuspend when MemoryCoordinator is enabled. (Closed)
Patch Set: Fixed comment. 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..5f63dba0b6b204fb236b97e2e8e27d081355c1a7 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1778,10 +1778,16 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
ChildThreadImpl::OnProcessPurgeAndSuspend();
if (!RendererIsHidden())
return;
+
+ // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled.
+ if (base::FeatureList::IsEnabled(features::kMemoryCoordinator))
+ 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 +1894,16 @@ void RenderThreadImpl::OnProcessResume() {
if (!RendererIsHidden())
return;
+
+ // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled.
+ 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 +2270,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 +2285,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 +2298,18 @@ void RenderThreadImpl::SuspendRenderer() {
OnTrimMemoryImmediately();
ReleaseFreeMemory();
ClearMemory();
- renderer_scheduler_->SuspendRenderer();
+ // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled.
+ if (!base::FeatureList::IsEnabled(features::kMemoryCoordinator) &&
+ base::FeatureList::IsEnabled(features::kPurgeAndSuspend))
+ renderer_scheduler_->SuspendRenderer();
}
void RenderThreadImpl::ResumeRenderer() {
DCHECK(IsMainThread());
- renderer_scheduler_->ResumeRenderer();
+ // TODO(bashi): Enable the tab suspension when MemoryCoordinator is enabled.
+ 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