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/task_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Returns true if the specified id should use the first value in the group. | 101 // Returns true if the specified id should use the first value in the group. |
102 bool IsSharedByGroup(int col_id) { | 102 bool IsSharedByGroup(int col_id) { |
103 switch (col_id) { | 103 switch (col_id) { |
104 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: | 104 case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: |
105 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: | 105 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: |
106 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: | 106 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: |
107 case IDS_TASK_MANAGER_CPU_COLUMN: | 107 case IDS_TASK_MANAGER_CPU_COLUMN: |
108 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: | 108 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: |
109 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN: | 109 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN: |
| 110 case IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN: |
110 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: | 111 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: |
111 case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN: | 112 case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN: |
112 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: | 113 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: |
113 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: | 114 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: |
114 return true; | 115 return true; |
115 default: | 116 default: |
116 return false; | 117 return false; |
117 } | 118 } |
118 } | 119 } |
119 | 120 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return FormatStatsSize( | 497 return FormatStatsSize( |
497 GetPerResourceValues(index).webcore_stats.cssStyleSheets); | 498 GetPerResourceValues(index).webcore_stats.cssStyleSheets); |
498 } | 499 } |
499 | 500 |
500 string16 TaskManagerModel::GetResourceVideoMemory(int index) const { | 501 string16 TaskManagerModel::GetResourceVideoMemory(int index) const { |
501 size_t video_memory; | 502 size_t video_memory; |
502 bool has_duplicates; | 503 bool has_duplicates; |
503 if (!GetVideoMemory(index, &video_memory, &has_duplicates) || !video_memory) | 504 if (!GetVideoMemory(index, &video_memory, &has_duplicates) || !video_memory) |
504 return ASCIIToUTF16("N/A"); | 505 return ASCIIToUTF16("N/A"); |
505 if (has_duplicates) { | 506 if (has_duplicates) { |
506 return ASCIIToUTF16("(") + | 507 return GetMemCellText(video_memory) + ASCIIToUTF16("*"); |
507 GetMemCellText(video_memory) + | |
508 ASCIIToUTF16(")"); | |
509 } | 508 } |
510 return GetMemCellText(video_memory); | 509 return GetMemCellText(video_memory); |
511 } | 510 } |
512 | 511 |
513 string16 TaskManagerModel::GetResourceFPS( | 512 string16 TaskManagerModel::GetResourceFPS( |
514 int index) const { | 513 int index) const { |
515 float fps = 0; | 514 float fps = 0; |
516 if (!GetFPS(index, &fps)) | 515 if (!GetFPS(index, &fps)) |
517 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 516 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
518 return UTF8ToUTF16(base::StringPrintf("%.0f", fps)); | 517 return UTF8ToUTF16(base::StringPrintf("%.0f", fps)); |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 1541 params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
1543 chrome::Navigate(¶ms); | 1542 chrome::Navigate(¶ms); |
1544 } | 1543 } |
1545 | 1544 |
1546 TaskManager::TaskManager() | 1545 TaskManager::TaskManager() |
1547 : model_(new TaskManagerModel(this)) { | 1546 : model_(new TaskManagerModel(this)) { |
1548 } | 1547 } |
1549 | 1548 |
1550 TaskManager::~TaskManager() { | 1549 TaskManager::~TaskManager() { |
1551 } | 1550 } |
OLD | NEW |