| OLD | NEW |
| 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" |
| 11 #include "base/stringprintf.h" |
| 11 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 12 #include "base/string_util.h" | |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/background_contents_service.h" | 15 #include "chrome/browser/background_contents_service.h" |
| 16 #include "chrome/browser/background_contents_service_factory.h" | 16 #include "chrome/browser/background_contents_service_factory.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/extensions/extension_host.h" | 18 #include "chrome/browser/extensions/extension_host.h" |
| 19 #include "chrome/browser/extensions/extension_process_manager.h" | 19 #include "chrome/browser/extensions/extension_process_manager.h" |
| 20 #include "chrome/browser/net/url_request_tracking.h" | 20 #include "chrome/browser/net/url_request_tracking.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); | 133 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); |
| 134 } | 134 } |
| 135 | 135 |
| 136 double TaskManagerModel::GetCPUUsage(int index) const { | 136 double TaskManagerModel::GetCPUUsage(int index) const { |
| 137 CHECK_LT(index, ResourceCount()); | 137 CHECK_LT(index, ResourceCount()); |
| 138 return GetCPUUsage(resources_[index]); | 138 return GetCPUUsage(resources_[index]); |
| 139 } | 139 } |
| 140 | 140 |
| 141 string16 TaskManagerModel::GetResourceCPUUsage(int index) const { | 141 string16 TaskManagerModel::GetResourceCPUUsage(int index) const { |
| 142 CHECK_LT(index, ResourceCount()); | 142 CHECK_LT(index, ResourceCount()); |
| 143 return UTF8ToUTF16(StringPrintf( | 143 return UTF8ToUTF16(base::StringPrintf( |
| 144 #if defined(OS_MACOSX) | 144 #if defined(OS_MACOSX) |
| 145 // Activity Monitor shows %cpu with one decimal digit -- be | 145 // Activity Monitor shows %cpu with one decimal digit -- be |
| 146 // consistent with that. | 146 // consistent with that. |
| 147 "%.1f", | 147 "%.1f", |
| 148 #else | 148 #else |
| 149 "%.0f", | 149 "%.0f", |
| 150 #endif | 150 #endif |
| 151 GetCPUUsage(resources_[index]))); | 151 GetCPUUsage(resources_[index]))); |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 // Count the number of extensions with background pages (including | 1045 // Count the number of extensions with background pages (including |
| 1046 // incognito). | 1046 // incognito). |
| 1047 count += CountExtensionBackgroundPagesForProfile(profile); | 1047 count += CountExtensionBackgroundPagesForProfile(profile); |
| 1048 if (profile->HasOffTheRecordProfile()) { | 1048 if (profile->HasOffTheRecordProfile()) { |
| 1049 count += CountExtensionBackgroundPagesForProfile( | 1049 count += CountExtensionBackgroundPagesForProfile( |
| 1050 profile->GetOffTheRecordProfile()); | 1050 profile->GetOffTheRecordProfile()); |
| 1051 } | 1051 } |
| 1052 } | 1052 } |
| 1053 return count; | 1053 return count; |
| 1054 } | 1054 } |
| OLD | NEW |