summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 21:25:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 21:25:33 +0000
commit65055ebfc2f1af07452599ac1117a1bc9b61dd8f (patch)
tree0e858a0b8676641b3af7808792a19b49dd9eb3df
parent9ecc5270b720634aaf019a3275cff7e564dd9fb1 (diff)
downloadchromium_src-65055ebfc2f1af07452599ac1117a1bc9b61dd8f.zip
chromium_src-65055ebfc2f1af07452599ac1117a1bc9b61dd8f.tar.gz
chromium_src-65055ebfc2f1af07452599ac1117a1bc9b61dd8f.tar.bz2
Make the cache columns in the Task Manager sortable and only displayed once per process on GTK and Mac, just like was already done on Windows.
BUG=16221 TEST=Open Task Manager on GTK or Mac, add a WebCore Cache column, see that it only prints one line of output per process, and verify it's sortable. Review URL: http://codereview.chromium.org/251046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27657 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/task_manager_mac.mm10
-rw-r--r--chrome/browser/gtk/task_manager_gtk.cc15
-rw-r--r--chrome/browser/gtk/task_manager_gtk.h22
3 files changed, 45 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/task_manager_mac.mm b/chrome/browser/cocoa/task_manager_mac.mm
index 1bc4f31..a35128c 100644
--- a/chrome/browser/cocoa/task_manager_mac.mm
+++ b/chrome/browser/cocoa/task_manager_mac.mm
@@ -62,7 +62,7 @@
initWithIdentifier:[NSNumber numberWithInt:columnId]]);
NSTextAlignment textAlignment = columnId == IDS_TASK_MANAGER_PAGE_COLUMN ?
- NSLeftTextAlignment : NSRightTextAlignment;
+ NSLeftTextAlignment : NSRightTextAlignment;
[[column.get() headerCell]
setStringValue:l10n_util::GetNSStringWithFixup(columnId)];
@@ -125,7 +125,7 @@
[column setHidden:newState == NSOffState];
[item setState:newState];
[tableView_ sizeToFit];
- [tableView_ setNeedsDisplay];
+ [tableView_ setNeedsDisplay];
}
@end
@@ -171,14 +171,20 @@
return base::SysWideToNSString(model_->GetResourceProcessId(row));
case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN: // WebCore image cache
+ if (!model_->IsResourceFirstInGroup(row))
+ return @"";
return base::SysWideToNSString(
model_->GetResourceWebCoreImageCacheSize(row));
case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: // WebCore script cache
+ if (!model_->IsResourceFirstInGroup(row))
+ return @"";
return base::SysWideToNSString(
model_->GetResourceWebCoreScriptsCacheSize(row));
case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: // WebCore CSS cache
+ if (!model_->IsResourceFirstInGroup(row))
+ return @"";
return base::SysWideToNSString(
model_->GetResourceWebCoreCSSCacheSize(row));
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc
index a80b294..daa1b0b 100644
--- a/chrome/browser/gtk/task_manager_gtk.cc
+++ b/chrome/browser/gtk/task_manager_gtk.cc
@@ -491,6 +491,15 @@ void TaskManagerGtk::CreateTaskManagerTreeview() {
kTaskManagerProcessID,
CompareProcessID, this, NULL);
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_),
+ kTaskManagerWebCoreImageCache,
+ CompareWebCoreImageCache, this, NULL);
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_),
+ kTaskManagerWebCoreScriptsCache,
+ CompareWebCoreScriptsCache, this, NULL);
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_),
+ kTaskManagerWebCoreCssCache,
+ CompareWebCoreCssCache, this, NULL);
+ gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_),
kTaskManagerGoatsTeleported,
CompareGoatsTeleported, this, NULL);
treeview_ = gtk_tree_view_new_with_model(process_list_sort_);
@@ -556,12 +565,18 @@ std::string TaskManagerGtk::GetModelText(int row, int col_id) {
return WideToUTF8(model_->GetResourceProcessId(row));
case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN:
+ if (!model_->IsResourceFirstInGroup(row))
+ return std::string();
return WideToUTF8(model_->GetResourceWebCoreImageCacheSize(row));
case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN:
+ if (!model_->IsResourceFirstInGroup(row))
+ return std::string();
return WideToUTF8(model_->GetResourceWebCoreScriptsCacheSize(row));
case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN:
+ if (!model_->IsResourceFirstInGroup(row))
+ return std::string();
return WideToUTF8(model_->GetResourceWebCoreCSSCacheSize(row));
case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: // Goats Teleported!
diff --git a/chrome/browser/gtk/task_manager_gtk.h b/chrome/browser/gtk/task_manager_gtk.h
index 05e77ab..c236b15 100644
--- a/chrome/browser/gtk/task_manager_gtk.h
+++ b/chrome/browser/gtk/task_manager_gtk.h
@@ -145,6 +145,28 @@ class TaskManagerGtk : public TaskManagerModelObserver {
CompareImpl(model, a, b, IDS_TASK_MANAGER_PROCESS_ID_COLUMN);
}
+ // WebCore Image Cache sorting callback.
+ static gint CompareWebCoreImageCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN);
+ }
+
+ // WebCore Scripts Cache sorting callback.
+ static gint CompareWebCoreScriptsCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b,
+ gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN);
+ }
+
+ // WebCore CSS Cache sorting callback.
+ static gint CompareWebCoreCssCache(GtkTreeModel* model, GtkTreeIter* a,
+ GtkTreeIter* b, gpointer task_manager) {
+ return reinterpret_cast<TaskManagerGtk*>(task_manager)->
+ CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN);
+ }
+
// Goats Teleported sorting callback.
static gint CompareGoatsTeleported(GtkTreeModel* model, GtkTreeIter* a,
GtkTreeIter* b, gpointer task_manager) {