diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 14:02:51 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 14:02:51 +0000 |
commit | bdaffe496ea996461e1008be92064236c0201a4c (patch) | |
tree | df917104a81897db626ca6271fe7730f84556995 | |
parent | ce3eb7b6edbb9fc155a42fab697aeab36f8f40e8 (diff) | |
download | chromium_src-bdaffe496ea996461e1008be92064236c0201a4c.zip chromium_src-bdaffe496ea996461e1008be92064236c0201a4c.tar.gz chromium_src-bdaffe496ea996461e1008be92064236c0201a4c.tar.bz2 |
Add to the task manager the v8 column on mac and the javascript column on mac and linux.
BUG=None (js column was added for windows in http://codereview.chromium.org/276009 ), 27226 (v8 column)
TEST=Add v8 and javascript columns using the task manager's context menu. should work on all platforms now.
Review URL: http://codereview.chromium.org/3419001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59366 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/task_manager_mac.mm | 19 | ||||
-rw-r--r-- | chrome/browser/gtk/task_manager_gtk.cc | 21 | ||||
-rw-r--r-- | chrome/browser/gtk/task_manager_gtk.h | 7 |
3 files changed, 46 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/task_manager_mac.mm b/chrome/browser/cocoa/task_manager_mac.mm index c977dd9..bc8d72a 100644 --- a/chrome/browser/cocoa/task_manager_mac.mm +++ b/chrome/browser/cocoa/task_manager_mac.mm @@ -49,6 +49,10 @@ const struct ColumnWidth { arraysize("2000.0K (2000.0 live)") * kCharWidth, -1 }, { IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN, arraysize("2000.0K (2000.0 live)") * kCharWidth, -1 }, + { IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN, + arraysize("800 kB") * kCharWidth, -1 }, + { IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN, + arraysize("2000.0K (2000.0 live)") * kCharWidth, -1 }, { IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN, arraysize("15 ") * kCharWidth, -1 }, }; @@ -274,6 +278,9 @@ class SortHelper { [self addColumnWithId:IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN visible:NO]; [self addColumnWithId:IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN visible:NO]; + [self addColumnWithId:IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN visible:NO]; + [self addColumnWithId:IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN + visible:NO]; [self addColumnWithId:IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN visible:NO]; } @@ -419,6 +426,18 @@ class SortHelper { return base::SysUTF16ToNSString( model_->GetResourceWebCoreCSSCacheSize(row)); + case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: + if (!model_->IsResourceFirstInGroup(row)) + return @""; + return base::SysUTF16ToNSString( + model_->GetResourceSqliteMemoryUsed(row)); + + case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN: + if (!model_->IsResourceFirstInGroup(row)) + return @""; + return base::SysUTF16ToNSString( + model_->GetResourceV8MemoryAllocatedSize(row)); + case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: // Goats Teleported! return base::SysUTF16ToNSString(model_->GetResourceGoatsTeleported(row)); diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc index a328101..5259863 100644 --- a/chrome/browser/gtk/task_manager_gtk.cc +++ b/chrome/browser/gtk/task_manager_gtk.cc @@ -65,6 +65,7 @@ enum TaskManagerColumn { kTaskManagerWebCoreImageCache, kTaskManagerWebCoreScriptsCache, kTaskManagerWebCoreCssCache, + kTaskManagerSqliteMemoryUsed, kTaskManagerGoatsTeleported, kTaskManagerColumnCount, }; @@ -91,6 +92,8 @@ TaskManagerColumn TaskManagerResourceIDToColumnID(int id) { return kTaskManagerWebCoreScriptsCache; case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: return kTaskManagerWebCoreCssCache; + case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: + return kTaskManagerSqliteMemoryUsed; case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: return kTaskManagerGoatsTeleported; default: @@ -121,6 +124,8 @@ int TaskManagerColumnIDToResourceID(int id) { return IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN; case kTaskManagerWebCoreCssCache: return IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN; + case kTaskManagerSqliteMemoryUsed: + return IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN; case kTaskManagerGoatsTeleported: return IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN; default: @@ -527,7 +532,8 @@ void TaskManagerGtk::CreateTaskManagerTreeview() { process_list_ = gtk_list_store_new(kTaskManagerColumnCount, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING); // Support sorting on all columns. process_list_sort_ = gtk_tree_model_sort_new_with_model( @@ -563,6 +569,9 @@ void TaskManagerGtk::CreateTaskManagerTreeview() { kTaskManagerWebCoreCssCache, CompareWebCoreCssCache, this, NULL); gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), + kTaskManagerSqliteMemoryUsed, + CompareSqliteMemoryUsed, 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_); @@ -580,6 +589,7 @@ void TaskManagerGtk::CreateTaskManagerTreeview() { TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN); TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN); + TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN); TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN); // Hide some columns by default. @@ -589,6 +599,7 @@ void TaskManagerGtk::CreateTaskManagerTreeview() { TreeViewColumnSetVisible(treeview_, kTaskManagerWebCoreImageCache, false); TreeViewColumnSetVisible(treeview_, kTaskManagerWebCoreScriptsCache, false); TreeViewColumnSetVisible(treeview_, kTaskManagerWebCoreCssCache, false); + TreeViewColumnSetVisible(treeview_, kTaskManagerSqliteMemoryUsed, false); TreeViewColumnSetVisible(treeview_, kTaskManagerGoatsTeleported, false); g_object_unref(process_list_); @@ -646,6 +657,9 @@ std::string TaskManagerGtk::GetModelText(int row, int col_id) { case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: return UTF16ToUTF8(model_->GetResourceWebCoreCSSCacheSize(row)); + case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: + return UTF16ToUTF8(model_->GetResourceSqliteMemoryUsed(row)); + case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: // Goats Teleported! return UTF16ToUTF8(model_->GetResourceGoatsTeleported(row)); @@ -695,6 +709,10 @@ void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { if (TreeViewColumnIsVisible(treeview_, kTaskManagerWebCoreCssCache)) wk_css_cache = GetModelText( row, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN); + std::string sqlite_memory; + if (TreeViewColumnIsVisible(treeview_, kTaskManagerSqliteMemoryUsed)) + sqlite_memory = GetModelText( + row, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN); std::string goats = GetModelText( row, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN); @@ -710,6 +728,7 @@ void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { kTaskManagerWebCoreImageCache, wk_img_cache.c_str(), kTaskManagerWebCoreScriptsCache, wk_scripts_cache.c_str(), kTaskManagerWebCoreCssCache, wk_css_cache.c_str(), + kTaskManagerSqliteMemoryUsed, sqlite_memory.c_str(), kTaskManagerGoatsTeleported, goats.c_str(), -1); g_object_unref(icon); diff --git a/chrome/browser/gtk/task_manager_gtk.h b/chrome/browser/gtk/task_manager_gtk.h index 985e9a4..7f9d5a1 100644 --- a/chrome/browser/gtk/task_manager_gtk.h +++ b/chrome/browser/gtk/task_manager_gtk.h @@ -179,6 +179,13 @@ class TaskManagerGtk : public TaskManagerModelObserver { CompareImpl(model, a, b, IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN); } + // Sqlite memory sorting callback. + static gint CompareSqliteMemoryUsed(GtkTreeModel* model, GtkTreeIter* a, + GtkTreeIter* b, gpointer task_manager) { + return reinterpret_cast<TaskManagerGtk*>(task_manager)-> + CompareImpl(model, a, b, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN); + } + // Goats Teleported sorting callback. static gint CompareGoatsTeleported(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, gpointer task_manager) { |