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

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

Issue 7831003: Add Profile data to the Task Manager on OS Mac. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/compiler_specific.h" 7 #include "base/compiler_specific.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/process_util.h" 10 #include "base/process_util.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) { 116 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) {
117 observer_list_.RemoveObserver(observer); 117 observer_list_.RemoveObserver(observer);
118 } 118 }
119 119
120 string16 TaskManagerModel::GetResourceTitle(int index) const { 120 string16 TaskManagerModel::GetResourceTitle(int index) const {
121 CHECK_LT(index, ResourceCount()); 121 CHECK_LT(index, ResourceCount());
122 return resources_[index]->GetTitle(); 122 return resources_[index]->GetTitle();
123 } 123 }
124 124
125 string16 TaskManagerModel::GetResourceProfileName(int index) const {
126 CHECK_LT(index, ResourceCount());
127 return resources_[index]->GetProfileName();
128 }
129
125 int64 TaskManagerModel::GetNetworkUsage(int index) const { 130 int64 TaskManagerModel::GetNetworkUsage(int index) const {
126 CHECK_LT(index, ResourceCount()); 131 CHECK_LT(index, ResourceCount());
127 return GetNetworkUsage(resources_[index]); 132 return GetNetworkUsage(resources_[index]);
128 } 133 }
129 134
130 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { 135 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const {
131 int64 net_usage = GetNetworkUsage(index); 136 int64 net_usage = GetNetworkUsage(index);
132 if (net_usage == -1) 137 if (net_usage == -1)
133 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); 138 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT);
134 if (net_usage == 0) 139 if (net_usage == 0)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 string16 title2 = GetResourceTitle(row2); 358 string16 title2 = GetResourceTitle(row2);
354 UErrorCode compare_status = U_ZERO_ERROR; 359 UErrorCode compare_status = U_ZERO_ERROR;
355 UCollationResult compare_result = collator->compare( 360 UCollationResult compare_result = collator->compare(
356 static_cast<const UChar*>(title1.c_str()), 361 static_cast<const UChar*>(title1.c_str()),
357 static_cast<int>(title1.length()), 362 static_cast<int>(title1.length()),
358 static_cast<const UChar*>(title2.c_str()), 363 static_cast<const UChar*>(title2.c_str()),
359 static_cast<int>(title2.length()), 364 static_cast<int>(title2.length()),
360 compare_status); 365 compare_status);
361 DCHECK(U_SUCCESS(compare_status)); 366 DCHECK(U_SUCCESS(compare_status));
362 return compare_result; 367 return compare_result;
368 } else if (col_id == IDS_TASK_MANAGER_PROFILE_NAME_COLUMN) {
369 string16 profile1 = GetResourceProfileName(row1);
370 string16 profile2 = GetResourceProfileName(row2);
371 return profile1.compare(0, profile1.length(), profile2, 0,
372 profile2.length());
363 } else if (col_id == IDS_TASK_MANAGER_NET_COLUMN) { 373 } else if (col_id == IDS_TASK_MANAGER_NET_COLUMN) {
364 return ValueCompare<int64>(GetNetworkUsage(resources_[row1]), 374 return ValueCompare<int64>(GetNetworkUsage(resources_[row1]),
365 GetNetworkUsage(resources_[row2])); 375 GetNetworkUsage(resources_[row2]));
366 } else if (col_id == IDS_TASK_MANAGER_CPU_COLUMN) { 376 } else if (col_id == IDS_TASK_MANAGER_CPU_COLUMN) {
367 return ValueCompare<double>(GetCPUUsage(resources_[row1]), 377 return ValueCompare<double>(GetCPUUsage(resources_[row1]),
368 GetCPUUsage(resources_[row2])); 378 GetCPUUsage(resources_[row2]));
369 } else if (col_id == IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN) { 379 } else if (col_id == IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN) {
370 size_t value1; 380 size_t value1;
371 size_t value2; 381 size_t value2;
372 if (!GetPrivateMemory(row1, &value1) || !GetPrivateMemory(row2, &value2)) 382 if (!GetPrivateMemory(row1, &value1) || !GetPrivateMemory(row2, &value2))
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 // Count the number of extensions with background pages (including 1118 // Count the number of extensions with background pages (including
1109 // incognito). 1119 // incognito).
1110 count += CountExtensionBackgroundPagesForProfile(profile); 1120 count += CountExtensionBackgroundPagesForProfile(profile);
1111 if (profile->HasOffTheRecordProfile()) { 1121 if (profile->HasOffTheRecordProfile()) {
1112 count += CountExtensionBackgroundPagesForProfile( 1122 count += CountExtensionBackgroundPagesForProfile(
1113 profile->GetOffTheRecordProfile()); 1123 profile->GetOffTheRecordProfile());
1114 } 1124 }
1115 } 1125 }
1116 return count; 1126 return count;
1117 } 1127 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager.h ('k') | chrome/browser/task_manager/task_manager_notification_resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698