summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 17:38:30 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 17:38:30 +0000
commitd0767cb54b2b5ee4d9cf00b3ee0fa585826b4036 (patch)
tree1c2ee733bf62a44c31dc11f76dad53243a84439f /chrome/browser/task_manager.cc
parente91d532339c854ff0a082c6562a519647524fa66 (diff)
downloadchromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.zip
chromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.tar.gz
chromium_src-d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036.tar.bz2
Separate out some more ICU from base and into base/i18n.
This moves string_util_icu. I moved the number formatting function into base/i18n/number_formatting and just removed the other function in string_util_icu which was TrimWhitespaceUTF8. It is only used in a few places and isn't actually helpful (and the fact that it round-trips through UTF-16 is better for the caller to see). This takes out the sorting from the FileEnumerator. The comment says the sorting is not guaranteed. I moved it into file_util_icu as a standalone function for callers of FileEnumerator to call manually if they need sorted results. I modified the directory lister to use this sorting instead, and filed a bug on doing more optimal JS-based sorting. TEST=none BUG=none Review URL: http://codereview.chromium.org/267001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index d01e94f..0af61ff 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
+#include "base/i18n/number_formatting.h"
#include "base/process_util.h"
#include "base/stats_table.h"
#include "base/string_util.h"
@@ -128,8 +129,7 @@ std::wstring TaskManagerModel::GetResourcePrivateMemory(int index) const {
metrics_map_.find(resources_[index]->GetProcess());
DCHECK(iter != metrics_map_.end());
base::ProcessMetrics* process_metrics = iter->second;
- std::wstring number = FormatNumber(GetPrivateMemory(process_metrics));
- return GetMemCellText(&number);
+ return GetMemCellText(GetPrivateMemory(process_metrics));
}
std::wstring TaskManagerModel::GetResourceSharedMemory(int index) const {
@@ -138,8 +138,7 @@ std::wstring TaskManagerModel::GetResourceSharedMemory(int index) const {
metrics_map_.find(resources_[index]->GetProcess());
DCHECK(iter != metrics_map_.end());
base::ProcessMetrics* process_metrics = iter->second;
- std::wstring number = FormatNumber(GetSharedMemory(process_metrics));
- return GetMemCellText(&number);
+ return GetMemCellText(GetSharedMemory(process_metrics));
}
std::wstring TaskManagerModel::GetResourcePhysicalMemory(int index) const {
@@ -148,8 +147,7 @@ std::wstring TaskManagerModel::GetResourcePhysicalMemory(int index) const {
metrics_map_.find(resources_[index]->GetProcess());
DCHECK(iter != metrics_map_.end());
base::ProcessMetrics* process_metrics = iter->second;
- std::wstring number = FormatNumber(GetPhysicalMemory(process_metrics));
- return GetMemCellText(&number);
+ return GetMemCellText(GetPhysicalMemory(process_metrics));
}
std::wstring TaskManagerModel::GetResourceProcessId(int index) const {
@@ -166,7 +164,7 @@ std::wstring TaskManagerModel::GetResourceStatsValue(int index, int col_id)
std::wstring TaskManagerModel::GetResourceGoatsTeleported(int index) const {
DCHECK(index < ResourceCount());
goats_teleported_ += rand() & 4095;
- return FormatNumber(goats_teleported_);
+ return UTF16ToWide(base::FormatNumber(goats_teleported_));
}
std::wstring TaskManagerModel::GetResourceWebCoreImageCacheSize(
@@ -385,11 +383,12 @@ int TaskManagerModel::GetStatsValue(const TaskManager::Resource* resource,
return 0;
}
-std::wstring TaskManagerModel::GetMemCellText(
- std::wstring* number) const {
+std::wstring TaskManagerModel::GetMemCellText(int64 number) const {
+ std::wstring str = UTF16ToWide(base::FormatNumber(number));
+
// Adjust number string if necessary.
- l10n_util::AdjustStringForLocaleDirection(*number, number);
- return l10n_util::GetStringF(IDS_TASK_MANAGER_MEM_CELL_TEXT, *number);
+ l10n_util::AdjustStringForLocaleDirection(str, &str);
+ return l10n_util::GetStringF(IDS_TASK_MANAGER_MEM_CELL_TEXT, str);
}
void TaskManagerModel::StartUpdating() {