| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" | 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 // The estimation is problematic since multiple tabs may share the same | 640 // The estimation is problematic since multiple tabs may share the same |
| 641 // process, while the calculation counts memory used by the whole process. | 641 // process, while the calculation counts memory used by the whole process. |
| 642 // So |estimated_memory_freed_kb| is an over-estimation. | 642 // So |estimated_memory_freed_kb| is an over-estimation. |
| 643 int estimated_memory_freed_kb = | 643 int estimated_memory_freed_kb = |
| 644 mem_stat_->EstimatedMemoryFreedKB(it->tab()->renderer_handle); | 644 mem_stat_->EstimatedMemoryFreedKB(it->tab()->renderer_handle); |
| 645 if (KillTab(tab_id)) { | 645 if (KillTab(tab_id)) { |
| 646 target_memory_to_free_kb -= estimated_memory_freed_kb; | 646 target_memory_to_free_kb -= estimated_memory_freed_kb; |
| 647 MemoryKillsMonitor::LogLowMemoryKill("TAB", estimated_memory_freed_kb); | 647 MemoryKillsMonitor::LogLowMemoryKill("TAB", estimated_memory_freed_kb); |
| 648 MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " | 648 MEMORY_LOG(ERROR) << "Killed " << *it << ", estimated " |
| 649 << estimated_memory_freed_kb << " KB freed"; | 649 << estimated_memory_freed_kb << " KB freed"; |
| 650 } else { | |
| 651 MEMORY_LOG(ERROR) << "Failed to kill " << *it; | |
| 652 } | 650 } |
| 653 } | 651 } |
| 654 } | 652 } |
| 655 if (target_memory_to_free_kb > 0) { | 653 if (target_memory_to_free_kb > 0) { |
| 656 MEMORY_LOG(ERROR) | 654 MEMORY_LOG(ERROR) |
| 657 << "Unable to kill enough candidates to meet target_memory_to_free_kb "; | 655 << "Unable to kill enough candidates to meet target_memory_to_free_kb "; |
| 658 } | 656 } |
| 659 } | 657 } |
| 660 | 658 |
| 661 void TabManagerDelegate::AdjustOomPrioritiesImpl( | 659 void TabManagerDelegate::AdjustOomPrioritiesImpl( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 751 } |
| 754 priority += priority_increment; | 752 priority += priority_increment; |
| 755 } | 753 } |
| 756 | 754 |
| 757 if (oom_scores_to_change.size()) | 755 if (oom_scores_to_change.size()) |
| 758 GetDebugDaemonClient()->SetOomScoreAdj( | 756 GetDebugDaemonClient()->SetOomScoreAdj( |
| 759 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); | 757 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); |
| 760 } | 758 } |
| 761 | 759 |
| 762 } // namespace memory | 760 } // namespace memory |
| OLD | NEW |