| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/memory/oom_priority_manager.h" | 5 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 start_time_ = TimeTicks::Now(); | 206 start_time_ = TimeTicks::Now(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void OomPriorityManager::Stop() { | 209 void OomPriorityManager::Stop() { |
| 210 timer_.Stop(); | 210 timer_.Stop(); |
| 211 recent_tab_discard_timer_.Stop(); | 211 recent_tab_discard_timer_.Stop(); |
| 212 if (low_memory_listener_.get()) | 212 if (low_memory_listener_.get()) |
| 213 low_memory_listener_->Stop(); | 213 low_memory_listener_->Stop(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 std::vector<string16> OomPriorityManager::GetTabTitles() { | 216 std::vector<base::string16> OomPriorityManager::GetTabTitles() { |
| 217 TabStatsList stats = GetTabStatsOnUIThread(); | 217 TabStatsList stats = GetTabStatsOnUIThread(); |
| 218 base::AutoLock pid_to_oom_score_autolock(pid_to_oom_score_lock_); | 218 base::AutoLock pid_to_oom_score_autolock(pid_to_oom_score_lock_); |
| 219 std::vector<string16> titles; | 219 std::vector<base::string16> titles; |
| 220 titles.reserve(stats.size()); | 220 titles.reserve(stats.size()); |
| 221 TabStatsList::iterator it = stats.begin(); | 221 TabStatsList::iterator it = stats.begin(); |
| 222 for ( ; it != stats.end(); ++it) { | 222 for ( ; it != stats.end(); ++it) { |
| 223 string16 str; | 223 base::string16 str; |
| 224 str.reserve(4096); | 224 str.reserve(4096); |
| 225 int score = pid_to_oom_score_[it->renderer_handle]; | 225 int score = pid_to_oom_score_[it->renderer_handle]; |
| 226 str += base::IntToString16(score); | 226 str += base::IntToString16(score); |
| 227 str += ASCIIToUTF16(" - "); | 227 str += ASCIIToUTF16(" - "); |
| 228 str += it->title; | 228 str += it->title; |
| 229 str += ASCIIToUTF16(it->is_app ? " app" : ""); | 229 str += ASCIIToUTF16(it->is_app ? " app" : ""); |
| 230 str += ASCIIToUTF16(it->is_reloadable_ui ? " reloadable_ui" : ""); | 230 str += ASCIIToUTF16(it->is_reloadable_ui ? " reloadable_ui" : ""); |
| 231 str += ASCIIToUTF16(it->is_playing_audio ? " playing_audio" : ""); | 231 str += ASCIIToUTF16(it->is_playing_audio ? " playing_audio" : ""); |
| 232 str += ASCIIToUTF16(it->is_pinned ? " pinned" : ""); | 232 str += ASCIIToUTF16(it->is_pinned ? " pinned" : ""); |
| 233 str += ASCIIToUTF16(it->is_discarded ? " discarded" : ""); | 233 str += ASCIIToUTF16(it->is_discarded ? " discarded" : ""); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 void OomPriorityManager::OnMemoryLow() { | 638 void OomPriorityManager::OnMemoryLow() { |
| 639 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 639 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 640 LogMemoryAndDiscardTab(); | 640 LogMemoryAndDiscardTab(); |
| 641 } | 641 } |
| 642 | 642 |
| 643 } // namespace chromeos | 643 } // namespace chromeos |
| OLD | NEW |