Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/browser/task_manager/task_manager.cc

Issue 102073008: Allow multiple NaCl modules to be debugged. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: 104 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN:
105 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: 105 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN:
106 case IDS_TASK_MANAGER_CPU_COLUMN: 106 case IDS_TASK_MANAGER_CPU_COLUMN:
107 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: 107 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN:
108 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN: 108 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN:
109 case IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN: 109 case IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN:
110 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: 110 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN:
111 case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN: 111 case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN:
112 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN: 112 case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN:
113 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN: 113 case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN:
114 case IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN:
114 return true; 115 return true;
115 default: 116 default:
116 return false; 117 return false;
117 } 118 }
118 } 119 }
119 120
120 #if defined(OS_WIN) 121 #if defined(OS_WIN)
121 void GetWinGDIHandles(base::ProcessHandle process, 122 void GetWinGDIHandles(base::ProcessHandle process,
122 size_t* current, 123 size_t* current,
123 size_t* peak) { 124 size_t* peak) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 BrowserThread::PostTask( 182 BrowserThread::PostTask(
182 BrowserThread::UI, FROM_HERE, base::Bind( 183 BrowserThread::UI, FROM_HERE, base::Bind(
183 &TaskManagerModelGpuDataManagerObserver:: 184 &TaskManagerModelGpuDataManagerObserver::
184 NotifyVideoMemoryUsageStats, 185 NotifyVideoMemoryUsageStats,
185 video_memory_usage_stats)); 186 video_memory_usage_stats));
186 } 187 }
187 } 188 }
188 }; 189 };
189 190
190 TaskManagerModel::PerResourceValues::PerResourceValues() 191 TaskManagerModel::PerResourceValues::PerResourceValues()
191 : is_title_valid(false), 192 : is_nacl_debug_stub_port_valid(false),
193 nacl_debug_stub_port(0),
194 is_title_valid(false),
192 is_profile_name_valid(false), 195 is_profile_name_valid(false),
193 network_usage(0), 196 network_usage(0),
194 is_process_id_valid(false), 197 is_process_id_valid(false),
195 process_id(0), 198 process_id(0),
196 is_goats_teleported_valid(false), 199 is_goats_teleported_valid(false),
197 goats_teleported(0), 200 goats_teleported(0),
198 is_webcore_stats_valid(false), 201 is_webcore_stats_valid(false),
199 is_fps_valid(false), 202 is_fps_valid(false),
200 fps(0), 203 fps(0),
201 is_sqlite_memory_bytes_valid(false), 204 is_sqlite_memory_bytes_valid(false),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 276 }
274 277
275 int TaskManagerModel::ResourceCount() const { 278 int TaskManagerModel::ResourceCount() const {
276 return resources_.size(); 279 return resources_.size();
277 } 280 }
278 281
279 int TaskManagerModel::GroupCount() const { 282 int TaskManagerModel::GroupCount() const {
280 return group_map_.size(); 283 return group_map_.size();
281 } 284 }
282 285
286 int TaskManagerModel::GetNaClDebugStubPort(int index) const {
287 PerResourceValues& values(GetPerResourceValues(index));
288 if (!values.is_nacl_debug_stub_port_valid) {
289 values.is_nacl_debug_stub_port_valid = true;
290 values.nacl_debug_stub_port = GetResource(index)->GetNaClDebugStubPort();
291 }
292 return values.nacl_debug_stub_port;
293 }
294
283 int64 TaskManagerModel::GetNetworkUsage(int index) const { 295 int64 TaskManagerModel::GetNetworkUsage(int index) const {
284 return GetNetworkUsage(GetResource(index)); 296 return GetNetworkUsage(GetResource(index));
285 } 297 }
286 298
287 double TaskManagerModel::GetCPUUsage(int index) const { 299 double TaskManagerModel::GetCPUUsage(int index) const {
288 return GetCPUUsage(GetResource(index)); 300 return GetCPUUsage(GetResource(index));
289 } 301 }
290 302
291 base::ProcessId TaskManagerModel::GetProcessId(int index) const { 303 base::ProcessId TaskManagerModel::GetProcessId(int index) const {
292 PerResourceValues& values(GetPerResourceValues(index)); 304 PerResourceValues& values(GetPerResourceValues(index));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 378
367 case IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN: 379 case IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN:
368 return GetResourceVideoMemory(index); 380 return GetResourceVideoMemory(index);
369 381
370 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN: 382 case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN:
371 return GetResourceSqliteMemoryUsed(index); 383 return GetResourceSqliteMemoryUsed(index);
372 384
373 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN: 385 case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN:
374 return GetResourceV8MemoryAllocatedSize(index); 386 return GetResourceV8MemoryAllocatedSize(index);
375 387
388 case IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN:
389 return GetResourceNaClDebugStubPort(index);
390
376 default: 391 default:
377 NOTREACHED(); 392 NOTREACHED();
378 return base::string16(); 393 return base::string16();
379 } 394 }
380 } 395 }
381 396
382 const base::string16& TaskManagerModel::GetResourceTitle(int index) const { 397 const base::string16& TaskManagerModel::GetResourceTitle(int index) const {
383 PerResourceValues& values = GetPerResourceValues(index); 398 PerResourceValues& values = GetPerResourceValues(index);
384 if (!values.is_title_valid) { 399 if (!values.is_title_valid) {
385 values.is_title_valid = true; 400 values.is_title_valid = true;
386 values.title = GetResource(index)->GetTitle(); 401 values.title = GetResource(index)->GetTitle();
387 } 402 }
388 return values.title; 403 return values.title;
389 } 404 }
390 405
391 const base::string16& TaskManagerModel::GetResourceProfileName( 406 const base::string16& TaskManagerModel::GetResourceProfileName(
392 int index) const { 407 int index) const {
393 PerResourceValues& values(GetPerResourceValues(index)); 408 PerResourceValues& values(GetPerResourceValues(index));
394 if (!values.is_profile_name_valid) { 409 if (!values.is_profile_name_valid) {
395 values.is_profile_name_valid = true; 410 values.is_profile_name_valid = true;
396 values.profile_name = GetResource(index)->GetProfileName(); 411 values.profile_name = GetResource(index)->GetProfileName();
397 } 412 }
398 return values.profile_name; 413 return values.profile_name;
399 } 414 }
400 415
416 base::string16 TaskManagerModel::GetResourceNaClDebugStubPort(int index) const {
417 int port = GetNaClDebugStubPort(index);
418 if (port == 0) {
419 return ASCIIToUTF16("N/A");
420 } else {
421 return base::IntToString16(port);
422 }
423 }
424
401 base::string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { 425 base::string16 TaskManagerModel::GetResourceNetworkUsage(int index) const {
402 int64 net_usage = GetNetworkUsage(index); 426 int64 net_usage = GetNetworkUsage(index);
403 if (net_usage == -1) 427 if (net_usage == -1)
404 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); 428 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT);
405 if (net_usage == 0) 429 if (net_usage == 0)
406 return ASCIIToUTF16("0"); 430 return ASCIIToUTF16("0");
407 base::string16 net_byte = ui::FormatSpeed(net_usage); 431 base::string16 net_byte = ui::FormatSpeed(net_usage);
408 // Force number string to have LTR directionality. 432 // Force number string to have LTR directionality.
409 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); 433 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte);
410 } 434 }
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 this, &TaskManagerModel::GetPrivateMemory, row1, row2); 865 this, &TaskManagerModel::GetPrivateMemory, row1, row2);
842 866
843 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: 867 case IDS_TASK_MANAGER_SHARED_MEM_COLUMN:
844 return ValueCompareMember( 868 return ValueCompareMember(
845 this, &TaskManagerModel::GetSharedMemory, row1, row2); 869 this, &TaskManagerModel::GetSharedMemory, row1, row2);
846 870
847 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: 871 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN:
848 return ValueCompareMember( 872 return ValueCompareMember(
849 this, &TaskManagerModel::GetPhysicalMemory, row1, row2); 873 this, &TaskManagerModel::GetPhysicalMemory, row1, row2);
850 874
875 case IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN:
876 return ValueCompare(GetNaClDebugStubPort(row1),
877 GetNaClDebugStubPort(row2));
878
851 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: 879 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN:
852 return ValueCompare(GetProcessId(row1), GetProcessId(row2)); 880 return ValueCompare(GetProcessId(row1), GetProcessId(row2));
853 881
854 case IDS_TASK_MANAGER_GDI_HANDLES_COLUMN: { 882 case IDS_TASK_MANAGER_GDI_HANDLES_COLUMN: {
855 size_t current1, peak1; 883 size_t current1, peak1;
856 size_t current2, peak2; 884 size_t current2, peak2;
857 GetGDIHandles(row1, &current1, &peak1); 885 GetGDIHandles(row1, &current1, &peak1);
858 GetGDIHandles(row2, &current2, &peak2); 886 GetGDIHandles(row2, &current2, &peak2);
859 return ValueCompare(current1, current2); 887 return ValueCompare(current1, current2);
860 } 888 }
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 params.host_desktop_type = desktop_type; 1569 params.host_desktop_type = desktop_type;
1542 chrome::Navigate(&params); 1570 chrome::Navigate(&params);
1543 } 1571 }
1544 1572
1545 TaskManager::TaskManager() 1573 TaskManager::TaskManager()
1546 : model_(new TaskManagerModel(this)) { 1574 : model_(new TaskManagerModel(this)) {
1547 } 1575 }
1548 1576
1549 TaskManager::~TaskManager() { 1577 TaskManager::~TaskManager() {
1550 } 1578 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698