Chromium Code Reviews| Index: chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| diff --git a/chrome/browser/memory/tab_manager_delegate_chromeos.cc b/chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| index 02ecbd66082c001cfadf4838dc00980d03710707..3224793f1e7edc839263876e979eee1820fcd9f1 100644 |
| --- a/chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| +++ b/chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| @@ -588,21 +588,23 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| GetSortedCandidates(tab_list, arc_processes); |
| int target_memory_to_free_kb = mem_stat_->TargetMemoryToFreeKB(); |
| - bool killed_candidate = false; |
| // Kill processes until the estimated amount of freed memory is sufficient to |
| // bring the system memory back to a normal level. |
| // The list is sorted by descending importance, so we go through the list |
| // backwards. |
| for (auto it = candidates.rbegin(); it != candidates.rend(); ++it) { |
| - VLOG(3) << "Target memory to free: " << target_memory_to_free_kb << " KB"; |
| + MEMORY_LOG(ERROR) << "Target memory to free: " << target_memory_to_free_kb |
| + << " KB"; |
| + if (target_memory_to_free_kb <= 0) |
| + break; |
| // Never kill selected tab or Android foreground app, regardless whether |
| // they're in the active window. Since the user experience would be bad. |
| ProcessType process_type = it->process_type(); |
| if (process_type == ProcessType::VISIBLE_APP || |
| process_type == ProcessType::FOCUSED_APP || |
| process_type == ProcessType::FOCUSED_TAB) { |
| - VLOG(2) << "Skipped killing " << *it; |
| + MEMORY_LOG(ERROR) << "Skipped killing " << *it; |
| continue; |
| } |
| if (it->app()) { |
| @@ -613,7 +615,8 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| MemoryKillsMonitor::LogLowMemoryKill("APP", estimated_memory_freed_kb); |
| MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " |
| << estimated_memory_freed_kb << " KB freed"; |
| - killed_candidate = true; |
| + } else { |
| + MEMORY_LOG(ERROR) << "Failed to kill " << *it; |
| } |
| } else { |
| int64_t tab_id = it->tab()->tab_contents_id; |
| @@ -627,16 +630,14 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| MemoryKillsMonitor::LogLowMemoryKill("TAB", estimated_memory_freed_kb); |
| MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " |
| << estimated_memory_freed_kb << " KB freed"; |
| - killed_candidate = true; |
| + } else { |
| + MEMORY_LOG(ERROR) << "Failed to kill " << *it; |
| } |
| } |
| - if (target_memory_to_free_kb < 0) |
| - break; |
| } |
| - if (!killed_candidate) { |
| - MEMORY_LOG(ERROR) << "Low memory: Unable to kill any candidates. " |
| - << "Attempted to free " << target_memory_to_free_kb |
| - << " KB"; |
| + if (target_memory_to_free_kb > 0) { |
| + MEMORY_LOG(ERROR) |
| + << "Unable to kill enough candidate to meet target_memory_to_free_kb "; |
|
teravest
2017/04/24 22:18:16
nit: s/candidate/candidates/
|
| } |
| } |