summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 17:59:03 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 17:59:03 +0000
commitec9773681c979a58f966d6cb0fc8ad16746e3adf (patch)
tree2cbc893a1d4eb757b5bc9691351419d2eeceb007 /chrome/browser/task_manager.cc
parent1224e328aa1210ed5c194a5626479ac15519f3af (diff)
downloadchromium_src-ec9773681c979a58f966d6cb0fc8ad16746e3adf.zip
chromium_src-ec9773681c979a58f966d6cb0fc8ad16746e3adf.tar.gz
chromium_src-ec9773681c979a58f966d6cb0fc8ad16746e3adf.tar.bz2
Adds three new off-by-default columns to the task manager to track WebCore caches
These values are currently exposed via about:histograms/WebCoreCache. This change allows for users to monitor the cache sizes in real-time broken out by renderer. TEST=Open task manager, right click on chrome, select columns, observe that they update along with browsing. BUG=16221 Review URL: http://codereview.chromium.org/217010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27216 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index 88083cc..1ac2411 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -37,6 +37,20 @@ static int ValueCompare(T value1, T value2) {
return 1;
}
+// TaskManager::Resource default impls.
+
+std::wstring TaskManager::Resource::GetWebCoreImageCacheSize() {
+ return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT);
+}
+
+std::wstring TaskManager::Resource::GetWebCoreScriptsCacheSize() {
+ return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT);
+}
+
+std::wstring TaskManager::Resource::GetWebCoreCSSCacheSize() {
+ return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT);
+}
+
////////////////////////////////////////////////////////////////////////////////
// TaskManagerModel class
////////////////////////////////////////////////////////////////////////////////
@@ -159,6 +173,25 @@ std::wstring TaskManagerModel::GetResourceGoatsTeleported(int index) const {
return FormatNumber(goats_teleported_);
}
+std::wstring TaskManagerModel::GetResourceWebCoreImageCacheSize(
+ int index) const {
+ DCHECK(index < ResourceCount());
+ return resources_[index]->GetWebCoreImageCacheSize();
+}
+
+std::wstring TaskManagerModel::GetResourceWebCoreScriptsCacheSize(
+ int index) const {
+ DCHECK(index < ResourceCount());
+ return resources_[index]->GetWebCoreScriptsCacheSize();
+}
+
+std::wstring TaskManagerModel::GetResourceWebCoreCSSCacheSize(
+ int index) const {
+ DCHECK(index < ResourceCount());
+ return resources_[index]->GetWebCoreCSSCacheSize();
+}
+
+
bool TaskManagerModel::IsResourceFirstInGroup(int index) const {
DCHECK(index < ResourceCount());
TaskManager::Resource* resource = resources_[index];
@@ -533,6 +566,17 @@ void TaskManagerModel::Clear() {
}
}
+void TaskManagerModel::NotifyResourceTypeStats(
+ base::ProcessId renderer_id,
+ const WebKit::WebCache::ResourceTypeStats& stats) {
+ for (ResourceList::iterator it = resources_.begin();
+ it != resources_.end(); ++it) {
+ if (base::GetProcId((*it)->GetProcess()) == renderer_id) {
+ (*it)->NotifyResourceTypeStats(stats);
+ }
+ }
+}
+
void TaskManagerModel::Refresh() {
DCHECK_NE(IDLE, update_state_);