Commit 7045b769 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

RC: Clarify log for apps/tabs not discarded because they are focused.

The imprecise logging caused confusion in the interpretaion of at
least one user report.

Change-Id: I50a80ef6e322072ae9143f11e6e86b314d1fb263
Reviewed-on: https://chromium-review.googlesource.com/c/1349771Reviewed-by: default avatarCheng-Yu Lee <cylee@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611237}
parent 2f2e9b04
...@@ -579,25 +579,24 @@ void TabManagerDelegate::LowMemoryKillImpl( ...@@ -579,25 +579,24 @@ void TabManagerDelegate::LowMemoryKillImpl(
<< " KB"; << " KB";
if (target_memory_to_free_kb <= 0) if (target_memory_to_free_kb <= 0)
break; break;
// Never kill selected tab, foreground app, and important apps regardless of
// whether they're in the active window. Since the user experience would be const ProcessType process_type = it->process_type();
// bad.
ProcessType process_type = it->process_type();
if (process_type <= ProcessType::IMPORTANT_APP) {
if (it->app()) {
MEMORY_LOG(ERROR) << "Skipped killing " << it->app()->process_name();
} else if (it->lifecycle_unit()) {
MEMORY_LOG(ERROR) << "Skipped killing "
<< it->lifecycle_unit()->GetTitle();
}
continue;
}
if (it->app()) { if (it->app()) {
if (IsRecentlyKilledArcProcess(it->app()->process_name(), now)) { if (process_type == ProcessType::FOCUSED_APP) {
MEMORY_LOG(ERROR) << "Skipped killing focused app "
<< it->app()->process_name();
continue;
} else if (process_type == ProcessType::IMPORTANT_APP) {
MEMORY_LOG(ERROR) << "Skipped killing important app "
<< it->app()->process_name();
continue;
} else if (IsRecentlyKilledArcProcess(it->app()->process_name(), now)) {
MEMORY_LOG(ERROR) << "Avoided killing " << it->app()->process_name() MEMORY_LOG(ERROR) << "Avoided killing " << it->app()->process_name()
<< " too often"; << " too often";
continue; continue;
} }
int estimated_memory_freed_kb = int estimated_memory_freed_kb =
mem_stat_->EstimatedMemoryFreedKB(it->app()->pid()); mem_stat_->EstimatedMemoryFreedKB(it->app()->pid());
if (KillArcProcess(it->app()->nspid())) { if (KillArcProcess(it->app()->nspid())) {
...@@ -616,6 +615,12 @@ void TabManagerDelegate::LowMemoryKillImpl( ...@@ -616,6 +615,12 @@ void TabManagerDelegate::LowMemoryKillImpl(
MEMORY_LOG(ERROR) << "Failed to kill " << it->app()->process_name(); MEMORY_LOG(ERROR) << "Failed to kill " << it->app()->process_name();
} }
} else if (it->lifecycle_unit()) { } else if (it->lifecycle_unit()) {
if (process_type == ProcessType::FOCUSED_TAB) {
MEMORY_LOG(ERROR) << "Skipped killing focused tab "
<< it->lifecycle_unit()->GetTitle();
continue;
}
// The estimation is problematic since multiple tabs may share the same // The estimation is problematic since multiple tabs may share the same
// process, while the calculation counts memory used by the whole process. // process, while the calculation counts memory used by the whole process.
// So |estimated_memory_freed_kb| is an over-estimation. // So |estimated_memory_freed_kb| is an over-estimation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment