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/task_manager.h" | 5 #include "chrome/browser/task_manager/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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 int TaskManagerModel::GetGoatsTeleported(int index) const { | 493 int TaskManagerModel::GetGoatsTeleported(int index) const { |
494 int seed = goat_salt_ * (index + 1); | 494 int seed = goat_salt_ * (index + 1); |
495 return (seed >> 16) & 255; | 495 return (seed >> 16) & 255; |
496 } | 496 } |
497 | 497 |
498 string16 TaskManagerModel::GetMemCellText(int64 number) const { | 498 string16 TaskManagerModel::GetMemCellText(int64 number) const { |
499 #if !defined(OS_MACOSX) | 499 #if !defined(OS_MACOSX) |
500 string16 str = base::FormatNumber(number / 1024); | 500 string16 str = base::FormatNumber(number / 1024); |
501 | 501 |
502 // Adjust number string if necessary. | 502 // Adjust number string if necessary. |
503 base::i18n::AdjustStringForLocaleDirection(str, &str); | 503 base::i18n::AdjustStringForLocaleDirection(&str); |
504 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_MEM_CELL_TEXT, str); | 504 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_MEM_CELL_TEXT, str); |
505 #else | 505 #else |
506 // System expectation is to show "100 KB", "200 MB", etc. | 506 // System expectation is to show "100 KB", "200 MB", etc. |
507 // TODO(thakis): Switch to metric units (as opposed to powers of two). | 507 // TODO(thakis): Switch to metric units (as opposed to powers of two). |
508 return FormatBytes(number, GetByteDisplayUnits(number), /*show_units=*/true); | 508 return FormatBytes(number, GetByteDisplayUnits(number), /*show_units=*/true); |
509 #endif | 509 #endif |
510 } | 510 } |
511 | 511 |
512 void TaskManagerModel::StartUpdating() { | 512 void TaskManagerModel::StartUpdating() { |
513 // Multiple StartUpdating requests may come in, and we only need to take | 513 // Multiple StartUpdating requests may come in, and we only need to take |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 1024 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
1025 if (iter == metrics_map_.end()) | 1025 if (iter == metrics_map_.end()) |
1026 return false; | 1026 return false; |
1027 | 1027 |
1028 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) | 1028 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) |
1029 return false; | 1029 return false; |
1030 | 1030 |
1031 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 1031 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
1032 return true; | 1032 return true; |
1033 } | 1033 } |
OLD | NEW |