| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_management/providers/child_process_task.h" | 5 #include "chrome/browser/task_management/providers/child_process_task.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/process_resource_usage.h" | 13 #include "chrome/browser/process_resource_usage.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/task_management/task_manager_observer.h" | 15 #include "chrome/browser/task_management/task_manager_observer.h" |
| 16 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/nacl/common/nacl_process_type.h" | 17 #include "components/nacl/common/nacl_process_type.h" |
| 18 #include "content/public/browser/browser_child_process_host.h" | 18 #include "content/public/browser/browser_child_process_host.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/child_process_data.h" | 20 #include "content/public/browser/child_process_data.h" |
| 21 #include "content/public/common/process_type.h" | 21 #include "content/public/common/process_type.h" |
| 22 #include "content/public/common/service_registry.h" | |
| 23 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 24 #include "extensions/common/extension_set.h" | 23 #include "extensions/common/extension_set.h" |
| 25 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 25 #include "services/shell/public/cpp/interface_provider.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 | 28 |
| 29 namespace task_management { | 29 namespace task_management { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 gfx::ImageSkia* g_default_icon = nullptr; | 33 gfx::ImageSkia* g_default_icon = nullptr; |
| 34 | 34 |
| 35 gfx::ImageSkia* GetDefaultIcon() { | 35 gfx::ImageSkia* GetDefaultIcon() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void ConnectResourceReporterOnIOThread( | 116 void ConnectResourceReporterOnIOThread( |
| 117 int unique_child_process_id, | 117 int unique_child_process_id, |
| 118 mojo::InterfaceRequest<mojom::ResourceUsageReporter> resource_reporter) { | 118 mojo::InterfaceRequest<mojom::ResourceUsageReporter> resource_reporter) { |
| 119 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 119 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 120 | 120 |
| 121 content::BrowserChildProcessHost* host = | 121 content::BrowserChildProcessHost* host = |
| 122 content::BrowserChildProcessHost::FromID(unique_child_process_id); | 122 content::BrowserChildProcessHost::FromID(unique_child_process_id); |
| 123 if (!host) | 123 if (!host) |
| 124 return; | 124 return; |
| 125 | 125 |
| 126 content::ServiceRegistry* registry = host->GetServiceRegistry(); | 126 host->GetRemoteInterfaces()->GetInterface(std::move(resource_reporter)); |
| 127 if (!registry) | |
| 128 return; | |
| 129 | |
| 130 registry->ConnectToRemoteService(std::move(resource_reporter)); | |
| 131 } | 127 } |
| 132 | 128 |
| 133 // Creates the Mojo service wrapper that will be used to sample the V8 memory | 129 // Creates the Mojo service wrapper that will be used to sample the V8 memory |
| 134 // usage of the browser child process whose unique ID is | 130 // usage of the browser child process whose unique ID is |
| 135 // |unique_child_process_id|. | 131 // |unique_child_process_id|. |
| 136 ProcessResourceUsage* CreateProcessResourcesSampler( | 132 ProcessResourceUsage* CreateProcessResourcesSampler( |
| 137 int unique_child_process_id) { | 133 int unique_child_process_id) { |
| 138 mojom::ResourceUsageReporterPtr service; | 134 mojom::ResourceUsageReporterPtr service; |
| 139 mojo::InterfaceRequest<mojom::ResourceUsageReporter> usage_reporter = | 135 mojo::InterfaceRequest<mojom::ResourceUsageReporter> usage_reporter = |
| 140 mojo::GetProxy(&service); | 136 mojo::GetProxy(&service); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 229 |
| 234 int64_t ChildProcessTask::GetV8MemoryAllocated() const { | 230 int64_t ChildProcessTask::GetV8MemoryAllocated() const { |
| 235 return v8_memory_allocated_; | 231 return v8_memory_allocated_; |
| 236 } | 232 } |
| 237 | 233 |
| 238 int64_t ChildProcessTask::GetV8MemoryUsed() const { | 234 int64_t ChildProcessTask::GetV8MemoryUsed() const { |
| 239 return v8_memory_used_; | 235 return v8_memory_used_; |
| 240 } | 236 } |
| 241 | 237 |
| 242 } // namespace task_management | 238 } // namespace task_management |
| OLD | NEW |