| 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/background/background_contents_service.h" | 17 #include "chrome/browser/background/background_contents_service.h" |
| 18 #include "chrome/browser/background/background_contents_service_factory.h" | 18 #include "chrome/browser/background/background_contents_service_factory.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/extensions/extension_host.h" | 20 #include "chrome/browser/extensions/extension_host.h" |
| 21 #include "chrome/browser/extensions/extension_process_manager.h" | 21 #include "chrome/browser/extensions/extension_process_manager.h" |
| 22 #include "chrome/browser/extensions/extension_system.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/browser/task_manager/task_manager_resource_providers.h" | 25 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
| 25 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" | 26 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" |
| 26 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 27 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
| 28 #include "chrome/browser/ui/browser_navigator.h" | 29 #include "chrome/browser/ui/browser_navigator.h" |
| 29 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 31 #include "chrome/common/view_type.h" | 32 #include "chrome/common/view_type.h" |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 | 1308 |
| 1308 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 1309 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
| 1309 return true; | 1310 return true; |
| 1310 } | 1311 } |
| 1311 | 1312 |
| 1312 namespace { | 1313 namespace { |
| 1313 | 1314 |
| 1314 // Counts the number of extension background pages associated with this profile. | 1315 // Counts the number of extension background pages associated with this profile. |
| 1315 int CountExtensionBackgroundPagesForProfile(Profile* profile) { | 1316 int CountExtensionBackgroundPagesForProfile(Profile* profile) { |
| 1316 int count = 0; | 1317 int count = 0; |
| 1317 ExtensionProcessManager* manager = profile->GetExtensionProcessManager(); | 1318 ExtensionProcessManager* manager = |
| 1319 extensions::ExtensionSystem::Get(profile)->process_manager(); |
| 1318 if (!manager) | 1320 if (!manager) |
| 1319 return count; | 1321 return count; |
| 1320 | 1322 |
| 1321 const ExtensionProcessManager::ExtensionHostSet& background_hosts = | 1323 const ExtensionProcessManager::ExtensionHostSet& background_hosts = |
| 1322 manager->background_hosts(); | 1324 manager->background_hosts(); |
| 1323 for (ExtensionProcessManager::const_iterator iter = background_hosts.begin(); | 1325 for (ExtensionProcessManager::const_iterator iter = background_hosts.begin(); |
| 1324 iter != background_hosts.end(); ++iter) { | 1326 iter != background_hosts.end(); ++iter) { |
| 1325 ++count; | 1327 ++count; |
| 1326 } | 1328 } |
| 1327 return count; | 1329 return count; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1351 // Count the number of extensions with background pages (including | 1353 // Count the number of extensions with background pages (including |
| 1352 // incognito). | 1354 // incognito). |
| 1353 count += CountExtensionBackgroundPagesForProfile(profile); | 1355 count += CountExtensionBackgroundPagesForProfile(profile); |
| 1354 if (profile->HasOffTheRecordProfile()) { | 1356 if (profile->HasOffTheRecordProfile()) { |
| 1355 count += CountExtensionBackgroundPagesForProfile( | 1357 count += CountExtensionBackgroundPagesForProfile( |
| 1356 profile->GetOffTheRecordProfile()); | 1358 profile->GetOffTheRecordProfile()); |
| 1357 } | 1359 } |
| 1358 } | 1360 } |
| 1359 return count; | 1361 return count; |
| 1360 } | 1362 } |
| OLD | NEW |