| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/task_manager_gtk.h" | 5 #include "chrome/browser/ui/gtk/task_manager_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const gint kTaskManagerResponseKill = 1; | 48 const gint kTaskManagerResponseKill = 1; |
| 49 | 49 |
| 50 // The resource id for the 'Stats for nerds' link button. | 50 // The resource id for the 'Stats for nerds' link button. |
| 51 const gint kTaskManagerAboutMemoryLink = 2; | 51 const gint kTaskManagerAboutMemoryLink = 2; |
| 52 | 52 |
| 53 // The resource id for the 'Purge Memory' button | 53 // The resource id for the 'Purge Memory' button |
| 54 const gint kTaskManagerPurgeMemory = 3; | 54 const gint kTaskManagerPurgeMemory = 3; |
| 55 | 55 |
| 56 enum TaskManagerColumn { | 56 enum TaskManagerColumn { |
| 57 kTaskManagerIcon, | 57 kTaskManagerIcon, |
| 58 kTaskManagerPage, | 58 kTaskManagerTask, |
| 59 kTaskManagerProfileName, | 59 kTaskManagerProfileName, |
| 60 kTaskManagerSharedMem, | 60 kTaskManagerSharedMem, |
| 61 kTaskManagerPrivateMem, | 61 kTaskManagerPrivateMem, |
| 62 kTaskManagerCPU, | 62 kTaskManagerCPU, |
| 63 kTaskManagerNetwork, | 63 kTaskManagerNetwork, |
| 64 kTaskManagerProcessID, | 64 kTaskManagerProcessID, |
| 65 kTaskManagerJavaScriptMemory, | 65 kTaskManagerJavaScriptMemory, |
| 66 kTaskManagerWebCoreImageCache, | 66 kTaskManagerWebCoreImageCache, |
| 67 kTaskManagerWebCoreScriptsCache, | 67 kTaskManagerWebCoreScriptsCache, |
| 68 kTaskManagerWebCoreCssCache, | 68 kTaskManagerWebCoreCssCache, |
| 69 kTaskManagerFPS, | 69 kTaskManagerFPS, |
| 70 kTaskManagerSqliteMemoryUsed, | 70 kTaskManagerSqliteMemoryUsed, |
| 71 kTaskManagerGoatsTeleported, | 71 kTaskManagerGoatsTeleported, |
| 72 // Columns below this point are not visible in the task manager. | 72 // Columns below this point are not visible in the task manager. |
| 73 kTaskManagerBackgroundColor, | 73 kTaskManagerBackgroundColor, |
| 74 kTaskManagerColumnCount, | 74 kTaskManagerColumnCount, |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 const TaskManagerColumn kTaskManagerLastVisibleColumn = | 77 const TaskManagerColumn kTaskManagerLastVisibleColumn = |
| 78 kTaskManagerGoatsTeleported; | 78 kTaskManagerGoatsTeleported; |
| 79 | 79 |
| 80 static const GdkColor kHighlightColor = GDK_COLOR_RGB(0xff, 0xfa, 0xcd); | 80 static const GdkColor kHighlightColor = GDK_COLOR_RGB(0xff, 0xfa, 0xcd); |
| 81 | 81 |
| 82 TaskManagerColumn TaskManagerResourceIDToColumnID(int id) { | 82 TaskManagerColumn TaskManagerResourceIDToColumnID(int id) { |
| 83 switch (id) { | 83 switch (id) { |
| 84 case IDS_TASK_MANAGER_PAGE_COLUMN: | 84 case IDS_TASK_MANAGER_TASK_COLUMN: |
| 85 return kTaskManagerPage; | 85 return kTaskManagerTask; |
| 86 case IDS_TASK_MANAGER_PROFILE_NAME_COLUMN: | 86 case IDS_TASK_MANAGER_PROFILE_NAME_COLUMN: |
| 87 return kTaskManagerProfileName; | 87 return kTaskManagerProfileName; |
| 88 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: | 88 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: |
| 89 return kTaskManagerSharedMem; | 89 return kTaskManagerSharedMem; |
| 90 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: | 90 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: |
| 91 return kTaskManagerPrivateMem; | 91 return kTaskManagerPrivateMem; |
| 92 case IDS_TASK_MANAGER_CPU_COLUMN: | 92 case IDS_TASK_MANAGER_CPU_COLUMN: |
| 93 return kTaskManagerCPU; | 93 return kTaskManagerCPU; |
| 94 case IDS_TASK_MANAGER_NET_COLUMN: | 94 case IDS_TASK_MANAGER_NET_COLUMN: |
| 95 return kTaskManagerNetwork; | 95 return kTaskManagerNetwork; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: | 110 case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: |
| 111 return kTaskManagerGoatsTeleported; | 111 return kTaskManagerGoatsTeleported; |
| 112 default: | 112 default: |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 return static_cast<TaskManagerColumn>(-1); | 114 return static_cast<TaskManagerColumn>(-1); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 int TaskManagerColumnIDToResourceID(int id) { | 118 int TaskManagerColumnIDToResourceID(int id) { |
| 119 switch (id) { | 119 switch (id) { |
| 120 case kTaskManagerPage: | 120 case kTaskManagerTask: |
| 121 return IDS_TASK_MANAGER_PAGE_COLUMN; | 121 return IDS_TASK_MANAGER_TASK_COLUMN; |
| 122 case kTaskManagerProfileName: | 122 case kTaskManagerProfileName: |
| 123 return IDS_TASK_MANAGER_PROFILE_NAME_COLUMN; | 123 return IDS_TASK_MANAGER_PROFILE_NAME_COLUMN; |
| 124 case kTaskManagerSharedMem: | 124 case kTaskManagerSharedMem: |
| 125 return IDS_TASK_MANAGER_SHARED_MEM_COLUMN; | 125 return IDS_TASK_MANAGER_SHARED_MEM_COLUMN; |
| 126 case kTaskManagerPrivateMem: | 126 case kTaskManagerPrivateMem: |
| 127 return IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN; | 127 return IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN; |
| 128 case kTaskManagerCPU: | 128 case kTaskManagerCPU: |
| 129 return IDS_TASK_MANAGER_CPU_COLUMN; | 129 return IDS_TASK_MANAGER_CPU_COLUMN; |
| 130 case kTaskManagerNetwork: | 130 case kTaskManagerNetwork: |
| 131 return IDS_TASK_MANAGER_NET_COLUMN; | 131 return IDS_TASK_MANAGER_NET_COLUMN; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 149 NOTREACHED(); | 149 NOTREACHED(); |
| 150 return -1; | 150 return -1; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 // Should be used for all gtk_tree_view functions that require a column index on | 154 // Should be used for all gtk_tree_view functions that require a column index on |
| 155 // input. | 155 // input. |
| 156 // | 156 // |
| 157 // We need colid - 1 because the gtk_tree_view function is asking for the | 157 // We need colid - 1 because the gtk_tree_view function is asking for the |
| 158 // column index, not the column id, and both kTaskManagerIcon and | 158 // column index, not the column id, and both kTaskManagerIcon and |
| 159 // kTaskManagerPage are in the same column index, so all column IDs are off by | 159 // kTaskManagerTask are in the same column index, so all column IDs are off by |
| 160 // one. | 160 // one. |
| 161 int TreeViewColumnIndexFromID(TaskManagerColumn colid) { | 161 int TreeViewColumnIndexFromID(TaskManagerColumn colid) { |
| 162 return colid - 1; | 162 return colid - 1; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Shows or hides a treeview column. | 165 // Shows or hides a treeview column. |
| 166 void TreeViewColumnSetVisible(GtkWidget* treeview, TaskManagerColumn colid, | 166 void TreeViewColumnSetVisible(GtkWidget* treeview, TaskManagerColumn colid, |
| 167 bool visible) { | 167 bool visible) { |
| 168 GtkTreeViewColumn* column = gtk_tree_view_get_column( | 168 GtkTreeViewColumn* column = gtk_tree_view_get_column( |
| 169 GTK_TREE_VIEW(treeview), TreeViewColumnIndexFromID(colid)); | 169 GTK_TREE_VIEW(treeview), TreeViewColumnIndexFromID(colid)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace | 228 } // namespace |
| 229 | 229 |
| 230 class TaskManagerGtk::ContextMenuController | 230 class TaskManagerGtk::ContextMenuController |
| 231 : public ui::SimpleMenuModel::Delegate { | 231 : public ui::SimpleMenuModel::Delegate { |
| 232 public: | 232 public: |
| 233 explicit ContextMenuController(TaskManagerGtk* task_manager) | 233 explicit ContextMenuController(TaskManagerGtk* task_manager) |
| 234 : task_manager_(task_manager) { | 234 : task_manager_(task_manager) { |
| 235 menu_model_.reset(new ui::SimpleMenuModel(this)); | 235 menu_model_.reset(new ui::SimpleMenuModel(this)); |
| 236 for (int i = kTaskManagerPage; i <= kTaskManagerLastVisibleColumn; i++) { | 236 for (int i = kTaskManagerTask; i <= kTaskManagerLastVisibleColumn; i++) { |
| 237 menu_model_->AddCheckItemWithStringId( | 237 menu_model_->AddCheckItemWithStringId( |
| 238 i, TaskManagerColumnIDToResourceID(i)); | 238 i, TaskManagerColumnIDToResourceID(i)); |
| 239 } | 239 } |
| 240 menu_.reset(new MenuGtk(NULL, menu_model_.get())); | 240 menu_.reset(new MenuGtk(NULL, menu_model_.get())); |
| 241 } | 241 } |
| 242 | 242 |
| 243 virtual ~ContextMenuController() {} | 243 virtual ~ContextMenuController() {} |
| 244 | 244 |
| 245 void RunMenu(const gfx::Point& point, guint32 event_time) { | 245 void RunMenu(const gfx::Point& point, guint32 event_time) { |
| 246 menu_->PopupAsContext(point, event_time); | 246 menu_->PopupAsContext(point, event_time); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 process_list_ = gtk_list_store_new(kTaskManagerColumnCount, | 559 process_list_ = gtk_list_store_new(kTaskManagerColumnCount, |
| 560 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, | 560 GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
| 561 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, | 561 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
| 562 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, | 562 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
| 563 G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_COLOR); | 563 G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_COLOR); |
| 564 | 564 |
| 565 // Support sorting on all columns. | 565 // Support sorting on all columns. |
| 566 process_list_sort_ = gtk_tree_model_sort_new_with_model( | 566 process_list_sort_ = gtk_tree_model_sort_new_with_model( |
| 567 GTK_TREE_MODEL(process_list_)); | 567 GTK_TREE_MODEL(process_list_)); |
| 568 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 568 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 569 kTaskManagerPage, | 569 kTaskManagerTask, |
| 570 ComparePage, this, NULL); | 570 ComparePage, this, NULL); |
| 571 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 571 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 572 kTaskManagerPage, | 572 kTaskManagerTask, |
| 573 CompareProfileName, this, NULL); | 573 CompareProfileName, this, NULL); |
| 574 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 574 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 575 kTaskManagerSharedMem, | 575 kTaskManagerSharedMem, |
| 576 CompareSharedMemory, this, NULL); | 576 CompareSharedMemory, this, NULL); |
| 577 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 577 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 578 kTaskManagerPrivateMem, | 578 kTaskManagerPrivateMem, |
| 579 ComparePrivateMemory, this, NULL); | 579 ComparePrivateMemory, this, NULL); |
| 580 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 580 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 581 kTaskManagerJavaScriptMemory, | 581 kTaskManagerJavaScriptMemory, |
| 582 CompareV8Memory, this, NULL); | 582 CompareV8Memory, this, NULL); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 603 CompareFPS, this, NULL); | 603 CompareFPS, this, NULL); |
| 604 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 604 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 605 kTaskManagerSqliteMemoryUsed, | 605 kTaskManagerSqliteMemoryUsed, |
| 606 CompareSqliteMemoryUsed, this, NULL); | 606 CompareSqliteMemoryUsed, this, NULL); |
| 607 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), | 607 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(process_list_sort_), |
| 608 kTaskManagerGoatsTeleported, | 608 kTaskManagerGoatsTeleported, |
| 609 CompareGoatsTeleported, this, NULL); | 609 CompareGoatsTeleported, this, NULL); |
| 610 treeview_ = gtk_tree_view_new_with_model(process_list_sort_); | 610 treeview_ = gtk_tree_view_new_with_model(process_list_sort_); |
| 611 | 611 |
| 612 // Insert all the columns. | 612 // Insert all the columns. |
| 613 TreeViewInsertColumnWithPixbuf(treeview_, IDS_TASK_MANAGER_PAGE_COLUMN); | 613 TreeViewInsertColumnWithPixbuf(treeview_, IDS_TASK_MANAGER_TASK_COLUMN); |
| 614 TreeViewInsertColumnWithPixbuf(treeview_, | 614 TreeViewInsertColumnWithPixbuf(treeview_, |
| 615 IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); | 615 IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); |
| 616 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_SHARED_MEM_COLUMN); | 616 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_SHARED_MEM_COLUMN); |
| 617 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN); | 617 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN); |
| 618 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_CPU_COLUMN); | 618 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_CPU_COLUMN); |
| 619 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_NET_COLUMN); | 619 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_NET_COLUMN); |
| 620 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_PROCESS_ID_COLUMN); | 620 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_PROCESS_ID_COLUMN); |
| 621 TreeViewInsertColumn(treeview_, | 621 TreeViewInsertColumn(treeview_, |
| 622 IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN); | 622 IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN); |
| 623 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN); | 623 TreeViewInsertColumn(treeview_, IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 default: | 657 default: |
| 658 return false; | 658 return false; |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 | 661 |
| 662 std::string TaskManagerGtk::GetModelText(int row, int col_id) { | 662 std::string TaskManagerGtk::GetModelText(int row, int col_id) { |
| 663 if (IsSharedByGroup(col_id) && !model_->IsResourceFirstInGroup(row)) | 663 if (IsSharedByGroup(col_id) && !model_->IsResourceFirstInGroup(row)) |
| 664 return std::string(); | 664 return std::string(); |
| 665 | 665 |
| 666 switch (col_id) { | 666 switch (col_id) { |
| 667 case IDS_TASK_MANAGER_PAGE_COLUMN: // Process | 667 case IDS_TASK_MANAGER_TASK_COLUMN: // Process |
| 668 return UTF16ToUTF8(model_->GetResourceTitle(row)); | 668 return UTF16ToUTF8(model_->GetResourceTitle(row)); |
| 669 | 669 |
| 670 case IDS_TASK_MANAGER_PROFILE_NAME_COLUMN: // Profile name | 670 case IDS_TASK_MANAGER_PROFILE_NAME_COLUMN: // Profile name |
| 671 return UTF16ToUTF8(model_->GetResourceProfileName(row)); | 671 return UTF16ToUTF8(model_->GetResourceProfileName(row)); |
| 672 | 672 |
| 673 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: // Memory | 673 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: // Memory |
| 674 return UTF16ToUTF8(model_->GetResourcePrivateMemory(row)); | 674 return UTF16ToUTF8(model_->GetResourcePrivateMemory(row)); |
| 675 | 675 |
| 676 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: // Memory | 676 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: // Memory |
| 677 return UTF16ToUTF8(model_->GetResourceSharedMemory(row)); | 677 return UTF16ToUTF8(model_->GetResourceSharedMemory(row)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 IDR_DEFAULT_FAVICON)->pixelRef()) { | 719 IDR_DEFAULT_FAVICON)->pixelRef()) { |
| 720 return static_cast<GdkPixbuf*>(g_object_ref( | 720 return static_cast<GdkPixbuf*>(g_object_ref( |
| 721 ThemeServiceGtk::GetDefaultFavicon(true)->ToGdkPixbuf())); | 721 ThemeServiceGtk::GetDefaultFavicon(true)->ToGdkPixbuf())); |
| 722 } | 722 } |
| 723 | 723 |
| 724 return gfx::GdkPixbufFromSkBitmap(&icon); | 724 return gfx::GdkPixbufFromSkBitmap(&icon); |
| 725 } | 725 } |
| 726 | 726 |
| 727 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { | 727 void TaskManagerGtk::SetRowDataFromModel(int row, GtkTreeIter* iter) { |
| 728 GdkPixbuf* icon = GetModelIcon(row); | 728 GdkPixbuf* icon = GetModelIcon(row); |
| 729 std::string page = GetModelText(row, IDS_TASK_MANAGER_PAGE_COLUMN); | 729 std::string task = GetModelText(row, IDS_TASK_MANAGER_TASK_COLUMN); |
| 730 std::string profile_name = | 730 std::string profile_name = |
| 731 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); | 731 GetModelText(row, IDS_TASK_MANAGER_PROFILE_NAME_COLUMN); |
| 732 gchar* page_markup = g_markup_escape_text(page.c_str(), page.length()); | 732 gchar* task_markup = g_markup_escape_text(task.c_str(), task.length()); |
| 733 std::string shared_mem = | 733 std::string shared_mem = |
| 734 GetModelText(row, IDS_TASK_MANAGER_SHARED_MEM_COLUMN); | 734 GetModelText(row, IDS_TASK_MANAGER_SHARED_MEM_COLUMN); |
| 735 std::string priv_mem = GetModelText(row, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN); | 735 std::string priv_mem = GetModelText(row, IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN); |
| 736 std::string cpu = GetModelText(row, IDS_TASK_MANAGER_CPU_COLUMN); | 736 std::string cpu = GetModelText(row, IDS_TASK_MANAGER_CPU_COLUMN); |
| 737 std::string net = GetModelText(row, IDS_TASK_MANAGER_NET_COLUMN); | 737 std::string net = GetModelText(row, IDS_TASK_MANAGER_NET_COLUMN); |
| 738 std::string procid = GetModelText(row, IDS_TASK_MANAGER_PROCESS_ID_COLUMN); | 738 std::string procid = GetModelText(row, IDS_TASK_MANAGER_PROCESS_ID_COLUMN); |
| 739 | 739 |
| 740 // Querying the renderer metrics is slow as it has to do IPC, so only do it | 740 // Querying the renderer metrics is slow as it has to do IPC, so only do it |
| 741 // when the columns are visible. | 741 // when the columns are visible. |
| 742 std::string javascript_memory; | 742 std::string javascript_memory; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 768 GetModelText(row, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN); | 768 GetModelText(row, IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN); |
| 769 } | 769 } |
| 770 | 770 |
| 771 std::string goats = | 771 std::string goats = |
| 772 GetModelText(row, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN); | 772 GetModelText(row, IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN); |
| 773 | 773 |
| 774 bool is_background = model_->IsBackgroundResource(row) && | 774 bool is_background = model_->IsBackgroundResource(row) && |
| 775 highlight_background_resources_; | 775 highlight_background_resources_; |
| 776 gtk_list_store_set(process_list_, iter, | 776 gtk_list_store_set(process_list_, iter, |
| 777 kTaskManagerIcon, icon, | 777 kTaskManagerIcon, icon, |
| 778 kTaskManagerPage, page_markup, | 778 kTaskManagerTask, task_markup, |
| 779 kTaskManagerProfileName, profile_name.c_str(), | 779 kTaskManagerProfileName, profile_name.c_str(), |
| 780 kTaskManagerSharedMem, shared_mem.c_str(), | 780 kTaskManagerSharedMem, shared_mem.c_str(), |
| 781 kTaskManagerPrivateMem, priv_mem.c_str(), | 781 kTaskManagerPrivateMem, priv_mem.c_str(), |
| 782 kTaskManagerCPU, cpu.c_str(), | 782 kTaskManagerCPU, cpu.c_str(), |
| 783 kTaskManagerNetwork, net.c_str(), | 783 kTaskManagerNetwork, net.c_str(), |
| 784 kTaskManagerProcessID, procid.c_str(), | 784 kTaskManagerProcessID, procid.c_str(), |
| 785 kTaskManagerJavaScriptMemory, javascript_memory.c_str(), | 785 kTaskManagerJavaScriptMemory, javascript_memory.c_str(), |
| 786 kTaskManagerWebCoreImageCache, wk_img_cache.c_str(), | 786 kTaskManagerWebCoreImageCache, wk_img_cache.c_str(), |
| 787 kTaskManagerWebCoreScriptsCache, wk_scripts_cache.c_str(), | 787 kTaskManagerWebCoreScriptsCache, wk_scripts_cache.c_str(), |
| 788 kTaskManagerWebCoreCssCache, wk_css_cache.c_str(), | 788 kTaskManagerWebCoreCssCache, wk_css_cache.c_str(), |
| 789 kTaskManagerFPS, fps.c_str(), | 789 kTaskManagerFPS, fps.c_str(), |
| 790 kTaskManagerSqliteMemoryUsed, sqlite_memory.c_str(), | 790 kTaskManagerSqliteMemoryUsed, sqlite_memory.c_str(), |
| 791 kTaskManagerGoatsTeleported, goats.c_str(), | 791 kTaskManagerGoatsTeleported, goats.c_str(), |
| 792 kTaskManagerBackgroundColor, | 792 kTaskManagerBackgroundColor, |
| 793 is_background ? &kHighlightColor : NULL, | 793 is_background ? &kHighlightColor : NULL, |
| 794 -1); | 794 -1); |
| 795 g_object_unref(icon); | 795 g_object_unref(icon); |
| 796 g_free(page_markup); | 796 g_free(task_markup); |
| 797 } | 797 } |
| 798 | 798 |
| 799 void TaskManagerGtk::KillSelectedProcesses() { | 799 void TaskManagerGtk::KillSelectedProcesses() { |
| 800 GtkTreeSelection* selection = gtk_tree_view_get_selection( | 800 GtkTreeSelection* selection = gtk_tree_view_get_selection( |
| 801 GTK_TREE_VIEW(treeview_)); | 801 GTK_TREE_VIEW(treeview_)); |
| 802 | 802 |
| 803 GtkTreeModel* model; | 803 GtkTreeModel* model; |
| 804 GList* paths = gtk_tree_selection_get_selected_rows(selection, &model); | 804 GList* paths = gtk_tree_selection_get_selected_rows(selection, &model); |
| 805 for (GList* item = paths; item; item = item->next) { | 805 for (GList* item = paths; item; item = item->next) { |
| 806 GtkTreePath* path = gtk_tree_model_sort_convert_path_to_child_path( | 806 GtkTreePath* path = gtk_tree_model_sort_convert_path_to_child_path( |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 guint keyval, | 966 guint keyval, |
| 967 GdkModifierType modifier) { | 967 GdkModifierType modifier) { |
| 968 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { | 968 if (keyval == GDK_w && modifier == GDK_CONTROL_MASK) { |
| 969 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget | 969 // The GTK_RESPONSE_DELETE_EVENT response must be sent before the widget |
| 970 // is destroyed. The deleted object will receive gtk signals otherwise. | 970 // is destroyed. The deleted object will receive gtk signals otherwise. |
| 971 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); | 971 gtk_dialog_response(GTK_DIALOG(dialog_), GTK_RESPONSE_DELETE_EVENT); |
| 972 } | 972 } |
| 973 | 973 |
| 974 return TRUE; | 974 return TRUE; |
| 975 } | 975 } |
| OLD | NEW |