| 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" |
| 11 #include "base/process/process_metrics.h" | 11 #include "base/process/process_metrics.h" |
| 12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/extensions/extension_process_manager.h" | |
| 20 #include "chrome/browser/extensions/extension_system.h" | 19 #include "chrome/browser/extensions/extension_system.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/task_manager/background_resource_provider.h" | 21 #include "chrome/browser/task_manager/background_resource_provider.h" |
| 23 #include "chrome/browser/task_manager/browser_process_resource_provider.h" | 22 #include "chrome/browser/task_manager/browser_process_resource_provider.h" |
| 24 #include "chrome/browser/task_manager/child_process_resource_provider.h" | 23 #include "chrome/browser/task_manager/child_process_resource_provider.h" |
| 25 #include "chrome/browser/task_manager/extension_process_resource_provider.h" | 24 #include "chrome/browser/task_manager/extension_process_resource_provider.h" |
| 26 #include "chrome/browser/task_manager/guest_resource_provider.h" | 25 #include "chrome/browser/task_manager/guest_resource_provider.h" |
| 27 #include "chrome/browser/task_manager/notification_resource_provider.h" | 26 #include "chrome/browser/task_manager/notification_resource_provider.h" |
| 28 #include "chrome/browser/task_manager/panel_resource_provider.h" | 27 #include "chrome/browser/task_manager/panel_resource_provider.h" |
| 29 #include "chrome/browser/task_manager/resource_provider.h" | 28 #include "chrome/browser/task_manager/resource_provider.h" |
| 30 #include "chrome/browser/task_manager/tab_contents_resource_provider.h" | 29 #include "chrome/browser/task_manager/tab_contents_resource_provider.h" |
| 31 #include "chrome/browser/task_manager/worker_resource_provider.h" | 30 #include "chrome/browser/task_manager/worker_resource_provider.h" |
| 32 #include "chrome/browser/ui/browser_navigator.h" | 31 #include "chrome/browser/ui/browser_navigator.h" |
| 33 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| 35 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/gpu_data_manager.h" | 35 #include "content/public/browser/gpu_data_manager.h" |
| 37 #include "content/public/browser/gpu_data_manager_observer.h" | 36 #include "content/public/browser/gpu_data_manager_observer.h" |
| 38 #include "content/public/browser/resource_request_info.h" | 37 #include "content/public/browser/resource_request_info.h" |
| 39 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
| 41 #include "content/public/common/result_codes.h" | 40 #include "content/public/common/result_codes.h" |
| 41 #include "extensions/browser/process_manager.h" |
| 42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 43 #include "grit/ui_resources.h" | 43 #include "grit/ui_resources.h" |
| 44 #include "third_party/icu/source/i18n/unicode/coll.h" | 44 #include "third_party/icu/source/i18n/unicode/coll.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 47 #include "ui/base/text/bytes_formatting.h" | 47 #include "ui/base/text/bytes_formatting.h" |
| 48 #include "ui/gfx/image/image_skia.h" | 48 #include "ui/gfx/image/image_skia.h" |
| 49 | 49 |
| 50 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 51 #include "content/public/browser/browser_child_process_host.h" | 51 #include "content/public/browser/browser_child_process_host.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 *current = GetGuiResources(process_with_query_rights, GR_USEROBJECTS); | 150 *current = GetGuiResources(process_with_query_rights, GR_USEROBJECTS); |
| 151 *peak = GetGuiResources(process_with_query_rights, GR_USEROBJECTS_PEAK); | 151 *peak = GetGuiResources(process_with_query_rights, GR_USEROBJECTS_PEAK); |
| 152 CloseHandle(process_with_query_rights); | 152 CloseHandle(process_with_query_rights); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 #endif | 155 #endif |
| 156 | 156 |
| 157 // Counts the number of extension background pages associated with this profile. | 157 // Counts the number of extension background pages associated with this profile. |
| 158 int CountExtensionBackgroundPagesForProfile(Profile* profile) { | 158 int CountExtensionBackgroundPagesForProfile(Profile* profile) { |
| 159 int count = 0; | 159 int count = 0; |
| 160 ExtensionProcessManager* manager = | 160 extensions::ProcessManager* manager = |
| 161 extensions::ExtensionSystem::Get(profile)->process_manager(); | 161 extensions::ExtensionSystem::Get(profile)->process_manager(); |
| 162 if (!manager) | 162 if (!manager) |
| 163 return count; | 163 return count; |
| 164 | 164 |
| 165 const ExtensionProcessManager::ExtensionHostSet& background_hosts = | 165 const extensions::ProcessManager::ExtensionHostSet& background_hosts = |
| 166 manager->background_hosts(); | 166 manager->background_hosts(); |
| 167 for (ExtensionProcessManager::const_iterator iter = background_hosts.begin(); | 167 for (extensions::ProcessManager::const_iterator iter = |
| 168 iter != background_hosts.end(); ++iter) { | 168 background_hosts.begin(); |
| 169 iter != background_hosts.end(); |
| 170 ++iter) { |
| 169 ++count; | 171 ++count; |
| 170 } | 172 } |
| 171 return count; | 173 return count; |
| 172 } | 174 } |
| 173 | 175 |
| 174 } // namespace | 176 } // namespace |
| 175 | 177 |
| 176 class TaskManagerModelGpuDataManagerObserver | 178 class TaskManagerModelGpuDataManagerObserver |
| 177 : public content::GpuDataManagerObserver { | 179 : public content::GpuDataManagerObserver { |
| 178 public: | 180 public: |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 params.host_desktop_type = desktop_type; | 1560 params.host_desktop_type = desktop_type; |
| 1559 chrome::Navigate(¶ms); | 1561 chrome::Navigate(¶ms); |
| 1560 } | 1562 } |
| 1561 | 1563 |
| 1562 TaskManager::TaskManager() | 1564 TaskManager::TaskManager() |
| 1563 : model_(new TaskManagerModel(this)) { | 1565 : model_(new TaskManagerModel(this)) { |
| 1564 } | 1566 } |
| 1565 | 1567 |
| 1566 TaskManager::~TaskManager() { | 1568 TaskManager::~TaskManager() { |
| 1567 } | 1569 } |
| OLD | NEW |