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> |
| 8 |
7 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
8 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/process_resource_usage.h" | 13 #include "chrome/browser/process_resource_usage.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/task_management/task_manager_observer.h" | 15 #include "chrome/browser/task_management/task_manager_observer.h" |
14 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
15 #include "components/nacl/common/nacl_process_type.h" | 17 #include "components/nacl/common/nacl_process_type.h" |
16 #include "content/public/browser/browser_child_process_host.h" | 18 #include "content/public/browser/browser_child_process_host.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 122 |
121 content::BrowserChildProcessHost* host = | 123 content::BrowserChildProcessHost* host = |
122 content::BrowserChildProcessHost::FromID(unique_child_process_id); | 124 content::BrowserChildProcessHost::FromID(unique_child_process_id); |
123 if (!host) | 125 if (!host) |
124 return; | 126 return; |
125 | 127 |
126 content::ServiceRegistry* registry = host->GetServiceRegistry(); | 128 content::ServiceRegistry* registry = host->GetServiceRegistry(); |
127 if (!registry) | 129 if (!registry) |
128 return; | 130 return; |
129 | 131 |
130 registry->ConnectToRemoteService(resource_reporter.Pass()); | 132 registry->ConnectToRemoteService(std::move(resource_reporter)); |
131 } | 133 } |
132 | 134 |
133 // Creates the Mojo service wrapper that will be used to sample the V8 memory | 135 // 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 | 136 // usage of the browser child process whose unique ID is |
135 // |unique_child_process_id|. | 137 // |unique_child_process_id|. |
136 ProcessResourceUsage* CreateProcessResourcesSampler( | 138 ProcessResourceUsage* CreateProcessResourcesSampler( |
137 int unique_child_process_id) { | 139 int unique_child_process_id) { |
138 ResourceUsageReporterPtr service; | 140 ResourceUsageReporterPtr service; |
139 mojo::InterfaceRequest<ResourceUsageReporter> usage_reporter = | 141 mojo::InterfaceRequest<ResourceUsageReporter> usage_reporter = |
140 mojo::GetProxy(&service); | 142 mojo::GetProxy(&service); |
141 | 143 |
142 content::BrowserThread::PostTask( | 144 content::BrowserThread::PostTask( |
143 content::BrowserThread::IO, | 145 content::BrowserThread::IO, |
144 FROM_HERE, | 146 FROM_HERE, |
145 base::Bind(&ConnectResourceReporterOnIOThread, | 147 base::Bind(&ConnectResourceReporterOnIOThread, |
146 unique_child_process_id, | 148 unique_child_process_id, |
147 base::Passed(&usage_reporter))); | 149 base::Passed(&usage_reporter))); |
148 | 150 |
149 return new ProcessResourceUsage(service.Pass()); | 151 return new ProcessResourceUsage(std::move(service)); |
150 } | 152 } |
151 | 153 |
152 bool UsesV8Memory(int process_type) { | 154 bool UsesV8Memory(int process_type) { |
153 switch (process_type) { | 155 switch (process_type) { |
154 case content::PROCESS_TYPE_UTILITY: | 156 case content::PROCESS_TYPE_UTILITY: |
155 case content::PROCESS_TYPE_BROWSER: | 157 case content::PROCESS_TYPE_BROWSER: |
156 case content::PROCESS_TYPE_RENDERER: | 158 case content::PROCESS_TYPE_RENDERER: |
157 return true; | 159 return true; |
158 | 160 |
159 default: | 161 default: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 236 |
235 int64_t ChildProcessTask::GetV8MemoryAllocated() const { | 237 int64_t ChildProcessTask::GetV8MemoryAllocated() const { |
236 return v8_memory_allocated_; | 238 return v8_memory_allocated_; |
237 } | 239 } |
238 | 240 |
239 int64_t ChildProcessTask::GetV8MemoryUsed() const { | 241 int64_t ChildProcessTask::GetV8MemoryUsed() const { |
240 return v8_memory_used_; | 242 return v8_memory_used_; |
241 } | 243 } |
242 | 244 |
243 } // namespace task_management | 245 } // namespace task_management |
OLD | NEW |