Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: chrome/browser/task_manager/providers/child_process_task.cc

Issue 2230283003: Revert of Establish MojoChildConnection from BrowserChildProcessHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-channel
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
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_manager/task_manager_observer.h" 15 #include "chrome/browser/task_manager/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/child_process_host.h"
22 #include "content/public/common/process_type.h" 21 #include "content/public/common/process_type.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"
26 #include "services/shell/public/cpp/interface_provider.h" 25 #include "services/shell/public/cpp/interface_provider.h"
27 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
29 28
30 namespace task_manager { 29 namespace task_manager {
31 30
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 case content::PROCESS_TYPE_SANDBOX_HELPER: 104 case content::PROCESS_TYPE_SANDBOX_HELPER:
106 case content::PROCESS_TYPE_MAX: 105 case content::PROCESS_TYPE_MAX:
107 break; 106 break;
108 case content::PROCESS_TYPE_UNKNOWN: 107 case content::PROCESS_TYPE_UNKNOWN:
109 NOTREACHED() << "Need localized name for child process type."; 108 NOTREACHED() << "Need localized name for child process type.";
110 } 109 }
111 110
112 return result_title; 111 return result_title;
113 } 112 }
114 113
115 // Connects the |resource_reporter| to the InterfaceRegistry of the 114 // Connects the |resource_reporter| to the ServiceRegistry of the
116 // BrowserChildProcessHost whose unique ID is |unique_child_process_id|. 115 // BrowserChildProcessHost whose unique ID is |unique_child_process_id|.
117 void ConnectResourceReporterOnIOThread( 116 void ConnectResourceReporterOnIOThread(
118 int unique_child_process_id, 117 int unique_child_process_id,
119 mojom::ResourceUsageReporterRequest resource_reporter) { 118 mojo::InterfaceRequest<mojom::ResourceUsageReporter> resource_reporter) {
120 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 119 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
121 120
122 content::BrowserChildProcessHost* host = 121 content::BrowserChildProcessHost* host =
123 content::BrowserChildProcessHost::FromID(unique_child_process_id); 122 content::BrowserChildProcessHost::FromID(unique_child_process_id);
124 if (!host) 123 if (!host)
125 return; 124 return;
126 125
127 shell::InterfaceProvider* interfaces = host->GetHost()->GetRemoteInterfaces(); 126 shell::InterfaceProvider* interfaces = host->GetRemoteInterfaces();
128 if (interfaces) 127 if (interfaces)
129 interfaces->GetInterface(std::move(resource_reporter)); 128 interfaces->GetInterface(std::move(resource_reporter));
130 } 129 }
131 130
132 // Creates the Mojo service wrapper that will be used to sample the V8 memory 131 // Creates the Mojo service wrapper that will be used to sample the V8 memory
133 // usage of the browser child process whose unique ID is 132 // usage of the browser child process whose unique ID is
134 // |unique_child_process_id|. 133 // |unique_child_process_id|.
135 ProcessResourceUsage* CreateProcessResourcesSampler( 134 ProcessResourceUsage* CreateProcessResourcesSampler(
136 int unique_child_process_id) { 135 int unique_child_process_id) {
137 mojom::ResourceUsageReporterPtr usage_reporter; 136 mojom::ResourceUsageReporterPtr service;
138 mojom::ResourceUsageReporterRequest request = mojo::GetProxy(&usage_reporter); 137 mojo::InterfaceRequest<mojom::ResourceUsageReporter> usage_reporter =
138 mojo::GetProxy(&service);
139
139 content::BrowserThread::PostTask( 140 content::BrowserThread::PostTask(
140 content::BrowserThread::IO, 141 content::BrowserThread::IO,
141 FROM_HERE, 142 FROM_HERE,
142 base::Bind(&ConnectResourceReporterOnIOThread, 143 base::Bind(&ConnectResourceReporterOnIOThread,
143 unique_child_process_id, base::Passed(&request))); 144 unique_child_process_id,
145 base::Passed(&usage_reporter)));
144 146
145 return new ProcessResourceUsage(std::move(usage_reporter)); 147 return new ProcessResourceUsage(std::move(service));
146 } 148 }
147 149
148 bool UsesV8Memory(int process_type) { 150 bool UsesV8Memory(int process_type) {
149 switch (process_type) { 151 switch (process_type) {
150 case content::PROCESS_TYPE_UTILITY: 152 case content::PROCESS_TYPE_UTILITY:
151 case content::PROCESS_TYPE_BROWSER: 153 case content::PROCESS_TYPE_BROWSER:
152 case content::PROCESS_TYPE_RENDERER: 154 case content::PROCESS_TYPE_RENDERER:
153 return true; 155 return true;
154 156
155 default: 157 default:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 231
230 int64_t ChildProcessTask::GetV8MemoryAllocated() const { 232 int64_t ChildProcessTask::GetV8MemoryAllocated() const {
231 return v8_memory_allocated_; 233 return v8_memory_allocated_;
232 } 234 }
233 235
234 int64_t ChildProcessTask::GetV8MemoryUsed() const { 236 int64_t ChildProcessTask::GetV8MemoryUsed() const {
235 return v8_memory_used_; 237 return v8_memory_used_;
236 } 238 }
237 239
238 } // namespace task_manager 240 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc ('k') | content/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698