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_manager/providers/child_process_task.h" | 5 #include "chrome/browser/task_manager/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" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 NOTREACHED() << "Need localized name for child process type."; | 109 NOTREACHED() << "Need localized name for child process type."; |
110 } | 110 } |
111 | 111 |
112 return result_title; | 112 return result_title; |
113 } | 113 } |
114 | 114 |
115 // Connects the |resource_reporter| to the InterfaceRegistry of the | 115 // Connects the |resource_reporter| to the InterfaceRegistry of the |
116 // BrowserChildProcessHost whose unique ID is |unique_child_process_id|. | 116 // BrowserChildProcessHost whose unique ID is |unique_child_process_id|. |
117 void ConnectResourceReporterOnIOThread( | 117 void ConnectResourceReporterOnIOThread( |
118 int unique_child_process_id, | 118 int unique_child_process_id, |
119 mojom::ResourceUsageReporterRequest resource_reporter) { | 119 chrome::mojom::ResourceUsageReporterRequest resource_reporter) { |
120 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 120 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
121 | 121 |
122 content::BrowserChildProcessHost* host = | 122 content::BrowserChildProcessHost* host = |
123 content::BrowserChildProcessHost::FromID(unique_child_process_id); | 123 content::BrowserChildProcessHost::FromID(unique_child_process_id); |
124 if (!host) | 124 if (!host) |
125 return; | 125 return; |
126 | 126 |
127 service_manager::InterfaceProvider* interfaces = | 127 service_manager::InterfaceProvider* interfaces = |
128 host->GetHost()->GetRemoteInterfaces(); | 128 host->GetHost()->GetRemoteInterfaces(); |
129 if (interfaces) | 129 if (interfaces) |
130 interfaces->GetInterface(std::move(resource_reporter)); | 130 interfaces->GetInterface(std::move(resource_reporter)); |
131 } | 131 } |
132 | 132 |
133 // Creates the Mojo service wrapper that will be used to sample the V8 memory | 133 // 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 | 134 // usage of the browser child process whose unique ID is |
135 // |unique_child_process_id|. | 135 // |unique_child_process_id|. |
136 ProcessResourceUsage* CreateProcessResourcesSampler( | 136 ProcessResourceUsage* CreateProcessResourcesSampler( |
137 int unique_child_process_id) { | 137 int unique_child_process_id) { |
138 mojom::ResourceUsageReporterPtr usage_reporter; | 138 chrome::mojom::ResourceUsageReporterPtr usage_reporter; |
139 mojom::ResourceUsageReporterRequest request = mojo::GetProxy(&usage_reporter); | 139 chrome::mojom::ResourceUsageReporterRequest request = |
| 140 mojo::GetProxy(&usage_reporter); |
140 content::BrowserThread::PostTask( | 141 content::BrowserThread::PostTask( |
141 content::BrowserThread::IO, | 142 content::BrowserThread::IO, |
142 FROM_HERE, | 143 FROM_HERE, |
143 base::Bind(&ConnectResourceReporterOnIOThread, | 144 base::Bind(&ConnectResourceReporterOnIOThread, |
144 unique_child_process_id, base::Passed(&request))); | 145 unique_child_process_id, base::Passed(&request))); |
145 | 146 |
146 return new ProcessResourceUsage(std::move(usage_reporter)); | 147 return new ProcessResourceUsage(std::move(usage_reporter)); |
147 } | 148 } |
148 | 149 |
149 bool UsesV8Memory(int process_type) { | 150 bool UsesV8Memory(int process_type) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 231 |
231 int64_t ChildProcessTask::GetV8MemoryAllocated() const { | 232 int64_t ChildProcessTask::GetV8MemoryAllocated() const { |
232 return v8_memory_allocated_; | 233 return v8_memory_allocated_; |
233 } | 234 } |
234 | 235 |
235 int64_t ChildProcessTask::GetV8MemoryUsed() const { | 236 int64_t ChildProcessTask::GetV8MemoryUsed() const { |
236 return v8_memory_used_; | 237 return v8_memory_used_; |
237 } | 238 } |
238 | 239 |
239 } // namespace task_manager | 240 } // namespace task_manager |
OLD | NEW |