| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/task_manager.h" | 5 #include "chrome/browser/task_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 template <class T> | 51 template <class T> |
| 52 int ValueCompare(T value1, T value2) { | 52 int ValueCompare(T value1, T value2) { |
| 53 if (value1 < value2) | 53 if (value1 < value2) |
| 54 return -1; | 54 return -1; |
| 55 if (value1 == value2) | 55 if (value1 == value2) |
| 56 return 0; | 56 return 0; |
| 57 return 1; | 57 return 1; |
| 58 } | 58 } |
| 59 | 59 |
| 60 std::wstring FormatStatsSize(const WebKit::WebCache::ResourceTypeStat& stat) { | 60 std::wstring FormatStatsSize(const WebKit::WebCache::ResourceTypeStat& stat) { |
| 61 // TODO(phajdan.jr): Remove this when we fix http://crbug.com/42301 properly. |
| 62 if (static_cast<int64>(stat.size) < 0 || |
| 63 static_cast<int64>(stat.liveSize) < 0) { |
| 64 return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT); |
| 65 } |
| 66 |
| 61 return l10n_util::GetStringF(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, | 67 return l10n_util::GetStringF(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, |
| 62 FormatBytes(stat.size, DATA_UNITS_KIBIBYTE, false), | 68 FormatBytes(stat.size, DATA_UNITS_KIBIBYTE, false), |
| 63 FormatBytes(stat.liveSize, DATA_UNITS_KIBIBYTE, false)); | 69 FormatBytes(stat.liveSize, DATA_UNITS_KIBIBYTE, false)); |
| 64 } | 70 } |
| 65 | 71 |
| 66 } // namespace | 72 } // namespace |
| 67 | 73 |
| 68 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
| 69 // TaskManagerModel class | 75 // TaskManagerModel class |
| 70 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 981 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
| 976 if (iter == metrics_map_.end()) | 982 if (iter == metrics_map_.end()) |
| 977 return false; | 983 return false; |
| 978 | 984 |
| 979 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) | 985 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) |
| 980 return false; | 986 return false; |
| 981 | 987 |
| 982 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 988 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
| 983 return true; | 989 return true; |
| 984 } | 990 } |
| OLD | NEW |