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 39a0f0cb50049b8a70f0d4c4847fb22da97faa94..1439c9955b324374fd9086b163d3277b4eee9838 100644 |
| --- a/chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| +++ b/chrome/browser/memory/tab_manager_delegate_chromeos.cc |
| @@ -121,13 +121,14 @@ std::ostream& operator<<(std::ostream& os, const ProcessType& type) { |
| std::ostream& operator<<( |
| std::ostream& out, const TabManagerDelegate::Candidate& candidate) { |
| if (candidate.app()) { |
| - out << "app " << candidate.app()->pid() << " (" |
| - << candidate.app()->process_name() << ")" |
| - << ", process_state " << candidate.app()->process_state() |
| - << ", is_focused " << candidate.app()->is_focused() |
| - << ", lastActivityTime " << candidate.app()->last_activity_time(); |
| + out << *candidate.app(); |
|
Yusuke Sato
2017/05/18 21:42:49
nit: ...and add back "app " here?
cylee1
2017/05/18 22:11:06
Done.
|
| } else if (candidate.tab()) { |
| - out << "tab " << candidate.tab()->renderer_handle; |
| + const TabStats* const& tab = candidate.tab(); |
| + out << "tab " << tab->title << " (" << tab->renderer_handle << ")" |
|
Yusuke Sato
2017/05/18 21:42:49
nit: same. maybe
tab->title << ", renderer_handl
cylee1
2017/05/18 22:11:06
Done.
|
| + << ", oom_score: " << tab->oom_score |
| + << ", is_discarded: " << tab->is_discarded |
| + << ", discard_count: " << tab->discard_count |
| + << ", last_active: " << tab->last_active; |
| } |
| out << ", process_type " << candidate.process_type(); |
| return out; |
| @@ -591,6 +592,10 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| int target_memory_to_free_kb = mem_stat_->TargetMemoryToFreeKB(); |
| const TimeTicks now = TimeTicks::Now(); |
| + MEMORY_LOG(ERROR) << "List of sorted low memory kill candidates:"; |
|
Yusuke Sato
2017/05/18 21:42:49
lowest-priority first, right? can you mention that
cylee1
2017/05/18 22:11:06
Done.
|
| + for (auto it = candidates.rbegin(); it != candidates.rend(); ++it) { |
| + MEMORY_LOG(ERROR) << *it; |
| + } |
| // 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 |
| @@ -605,12 +610,13 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| // bad. |
| ProcessType process_type = it->process_type(); |
| if (process_type <= ProcessType::IMPORTANT_APP) { |
| - MEMORY_LOG(ERROR) << "Skipped killing " << *it; |
| + MEMORY_LOG(ERROR) << "Skipped killing " << it->app()->process_name(); |
| continue; |
| } |
| if (it->app()) { |
| if (IsRecentlyKilledArcProcess(it->app()->process_name(), now)) { |
| - MEMORY_LOG(ERROR) << "Avoided killing " << *it << " too often"; |
| + MEMORY_LOG(ERROR) << "Avoided killing " << it->app()->process_name() |
| + << " too often"; |
| continue; |
| } |
| int estimated_memory_freed_kb = |
| @@ -619,10 +625,11 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| recently_killed_arc_processes_[it->app()->process_name()] = now; |
| target_memory_to_free_kb -= estimated_memory_freed_kb; |
| MemoryKillsMonitor::LogLowMemoryKill("APP", estimated_memory_freed_kb); |
| - MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " |
| - << estimated_memory_freed_kb << " KB freed"; |
| + MEMORY_LOG(ERROR) << "Killed " << it->app()->process_name() |
|
Yusuke Sato
2017/05/18 21:45:49
nit: pid is missing which is inconsistent with L64
cylee1
2017/05/18 22:11:06
That's intentional. Normally there's only one app
|
| + << ", estimated " << estimated_memory_freed_kb |
| + << " KB freed"; |
| } else { |
| - MEMORY_LOG(ERROR) << "Failed to kill " << *it; |
| + MEMORY_LOG(ERROR) << "Failed to kill " << it->app()->process_name(); |
| } |
| } else { |
| int64_t tab_id = it->tab()->tab_contents_id; |
| @@ -634,7 +641,8 @@ void TabManagerDelegate::LowMemoryKillImpl( |
| if (KillTab(tab_id)) { |
| target_memory_to_free_kb -= estimated_memory_freed_kb; |
| MemoryKillsMonitor::LogLowMemoryKill("TAB", estimated_memory_freed_kb); |
| - MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " |
| + MEMORY_LOG(ERROR) << "Killed " << it->tab()->title << " (" |
| + << it->tab()->renderer_handle << "), estimated " |
| << estimated_memory_freed_kb << " KB freed"; |
| } |
| } |