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

Side by Side Diff: content/browser/utility_process_host_impl.cc

Issue 972083002: Report utility process JS memory in task manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-pac-oop
Patch Set: Clean up. Created 5 years, 8 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 (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 "content/browser/utility_process_host_impl.h" 5 #include "content/browser/utility_process_host_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/process/process_handle.h" 13 #include "base/process/process_handle.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
19 #include "content/browser/browser_child_process_host_impl.h" 19 #include "content/browser/browser_child_process_host_impl.h"
20 #include "content/browser/mojo/mojo_application_host.h" 20 #include "content/browser/mojo/mojo_application_host.h"
21 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
22 #include "content/common/child_process_host_impl.h" 22 #include "content/common/child_process_host_impl.h"
23 #include "content/common/in_process_child_thread_params.h" 23 #include "content/common/in_process_child_thread_params.h"
24 #include "content/common/utility_messages.h" 24 #include "content/common/utility_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
27 #include "content/public/browser/utility_process_host_client.h" 27 #include "content/public/browser/utility_process_host_client.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "content/public/common/process_type.h" 29 #include "content/public/common/process_type.h"
30 #include "content/public/common/resource_usage_reporter.mojom.h"
30 #include "content/public/common/sandboxed_process_launcher_delegate.h" 31 #include "content/public/common/sandboxed_process_launcher_delegate.h"
31 #include "ipc/ipc_switches.h" 32 #include "ipc/ipc_switches.h"
32 #include "ui/base/ui_base_switches.h" 33 #include "ui/base/ui_base_switches.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 // NOTE: changes to this class need to be reviewed by the security team. 37 // NOTE: changes to this class need to be reviewed by the security team.
37 class UtilitySandboxedProcessLauncherDelegate 38 class UtilitySandboxedProcessLauncherDelegate
38 : public SandboxedProcessLauncherDelegate { 39 : public SandboxedProcessLauncherDelegate {
39 public: 40 public:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return true; 202 return true;
202 started_ = true; 203 started_ = true;
203 204
204 if (is_batch_mode_) 205 if (is_batch_mode_)
205 return true; 206 return true;
206 207
207 // Name must be set or metrics_service will crash in any test which 208 // Name must be set or metrics_service will crash in any test which
208 // launches a UtilityProcessHost. 209 // launches a UtilityProcessHost.
209 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this)); 210 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this));
210 process_->SetName(name_); 211 process_->SetName(name_);
212 if (mojo_application_host_) {
213 ResourceUsageReporterPtr service;
214 GetServiceRegistry()->ConnectToRemoteService(&service);
215 process_->SetResourceUsageReporter(service.Pass());
216 }
211 217
212 std::string channel_id = process_->GetHost()->CreateChannel(); 218 std::string channel_id = process_->GetHost()->CreateChannel();
213 if (channel_id.empty()) 219 if (channel_id.empty())
214 return false; 220 return false;
215 221
216 if (RenderProcessHost::run_renderer_in_process()) { 222 if (RenderProcessHost::run_renderer_in_process()) {
217 DCHECK(g_utility_main_thread_factory); 223 DCHECK(g_utility_main_thread_factory);
218 // See comment in RenderProcessHostImpl::Init() for the background on why we 224 // See comment in RenderProcessHostImpl::Init() for the background on why we
219 // support single process mode this way. 225 // support single process mode this way.
220 in_process_thread_.reset( 226 in_process_thread_.reset(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 if (RenderProcessHost::run_renderer_in_process()) 345 if (RenderProcessHost::run_renderer_in_process())
340 handle = base::GetCurrentProcessHandle(); 346 handle = base::GetCurrentProcessHandle();
341 else 347 else
342 handle = process_->GetData().handle; 348 handle = process_->GetData().handle;
343 349
344 mojo_application_host_->Activate(this, handle); 350 mojo_application_host_->Activate(this, handle);
345 } 351 }
346 } 352 }
347 353
348 } // namespace content 354 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698