| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/task_manager/task_manager_columns.h" | 5 #include "chrome/browser/ui/task_manager/task_manager_columns.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 const char kSortColumnIdKey[] = "sort_column_id"; | 92 const char kSortColumnIdKey[] = "sort_column_id"; |
| 93 const char kSortIsAscendingKey[] = "sort_is_ascending"; | 93 const char kSortIsAscendingKey[] = "sort_is_ascending"; |
| 94 | 94 |
| 95 // We can't use the integer IDs of the columns converted to strings as session | 95 // We can't use the integer IDs of the columns converted to strings as session |
| 96 // restore keys. These integer values can change from one build to another as | 96 // restore keys. These integer values can change from one build to another as |
| 97 // they are generated. Instead we use the literal string value of the column | 97 // they are generated. Instead we use the literal string value of the column |
| 98 // ID symbol (i.e. for the ID IDS_TASK_MANAGER_TASK_COLUMN, we use the literal | 98 // ID symbol (i.e. for the ID IDS_TASK_MANAGER_TASK_COLUMN, we use the literal |
| 99 // string "IDS_TASK_MANAGER_TASK_COLUMN". The following macros help us | 99 // string "IDS_TASK_MANAGER_TASK_COLUMN". The following macros help us |
| 100 // efficiently get the literal ID for the integer value. | 100 // efficiently get the literal ID for the integer value. |
| 101 #define COLUMNS_LITS(def) \ | 101 #define COLUMNS_LIST(def) \ |
| 102 def(IDS_TASK_MANAGER_TASK_COLUMN) \ | 102 def(IDS_TASK_MANAGER_TASK_COLUMN) \ |
| 103 def(IDS_TASK_MANAGER_PROFILE_NAME_COLUMN) \ | 103 def(IDS_TASK_MANAGER_PROFILE_NAME_COLUMN) \ |
| 104 def(IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN) \ | 104 def(IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN) \ |
| 105 def(IDS_TASK_MANAGER_SHARED_MEM_COLUMN) \ | 105 def(IDS_TASK_MANAGER_SHARED_MEM_COLUMN) \ |
| 106 def(IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN) \ | 106 def(IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN) \ |
| 107 def(IDS_TASK_MANAGER_SWAPPED_MEM_COLUMN) \ | 107 def(IDS_TASK_MANAGER_SWAPPED_MEM_COLUMN) \ |
| 108 def(IDS_TASK_MANAGER_CPU_COLUMN) \ | 108 def(IDS_TASK_MANAGER_CPU_COLUMN) \ |
| 109 def(IDS_TASK_MANAGER_NET_COLUMN) \ | 109 def(IDS_TASK_MANAGER_NET_COLUMN) \ |
| 110 def(IDS_TASK_MANAGER_PROCESS_ID_COLUMN) \ | 110 def(IDS_TASK_MANAGER_PROCESS_ID_COLUMN) \ |
| 111 def(IDS_TASK_MANAGER_GDI_HANDLES_COLUMN) \ | 111 def(IDS_TASK_MANAGER_GDI_HANDLES_COLUMN) \ |
| 112 def(IDS_TASK_MANAGER_USER_HANDLES_COLUMN) \ | 112 def(IDS_TASK_MANAGER_USER_HANDLES_COLUMN) \ |
| 113 def(IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN) \ | 113 def(IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN) \ |
| 114 def(IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN) \ | 114 def(IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN) \ |
| 115 def(IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN) \ | 115 def(IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN) \ |
| 116 def(IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN) \ | 116 def(IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN) \ |
| 117 def(IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN) \ | 117 def(IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN) \ |
| 118 def(IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN) \ | 118 def(IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN) \ |
| 119 def(IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN) \ | 119 def(IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN) \ |
| 120 def(IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN) \ | 120 def(IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN) \ |
| 121 def(IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN) \ | 121 def(IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN) \ |
| 122 def(IDS_TASK_MANAGER_PROCESS_PRIORITY_COLUMN) | 122 def(IDS_TASK_MANAGER_PROCESS_PRIORITY_COLUMN) |
| 123 // Add to the above list in the macro any new IDs added in the future. Also | 123 // Add to the above list in the macro any new IDs added in the future. Also |
| 124 // remove the removed ones. | 124 // remove the removed ones. |
| 125 | 125 |
| 126 #define COLUMN_ID_AS_STRING(col_id) case col_id: return std::string(#col_id); | 126 #define COLUMN_ID_AS_STRING(col_id) case col_id: return std::string(#col_id); |
| 127 | 127 |
| 128 std::string GetColumnIdAsString(int column_id) { | 128 std::string GetColumnIdAsString(int column_id) { |
| 129 switch (column_id) { | 129 switch (column_id) { |
| 130 COLUMNS_LITS(COLUMN_ID_AS_STRING) | 130 COLUMNS_LIST(COLUMN_ID_AS_STRING) |
| 131 default: | 131 default: |
| 132 NOTREACHED(); | 132 NOTREACHED(); |
| 133 return std::string(); | 133 return std::string(); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 | |
| 138 } // namespace task_management | 137 } // namespace task_management |
| OLD | NEW |