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

Side by Side Diff: components/tracing/child_memory_dump_manager_delegate_impl.cc

Issue 1629393003: Reland of [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: Created 4 years, 11 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
« no previous file with comments | « components/tracing/BUILD.gn ('k') | components/tracing/process_metrics_memory_dump_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/tracing/child_memory_dump_manager_delegate_impl.h" 5 #include "components/tracing/child_memory_dump_manager_delegate_impl.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "build/build_config.h"
8 #include "components/tracing/child_trace_message_filter.h" 9 #include "components/tracing/child_trace_message_filter.h"
10 #include "components/tracing/process_metrics_memory_dump_provider.h"
9 11
10 namespace tracing { 12 namespace tracing {
11 13
12 namespace { 14 namespace {
13 void AbortDumpRequest(const base::trace_event::MemoryDumpRequestArgs& args, 15 void AbortDumpRequest(const base::trace_event::MemoryDumpRequestArgs& args,
14 const base::trace_event::MemoryDumpCallback& callback) { 16 const base::trace_event::MemoryDumpCallback& callback) {
15 if (!callback.is_null()) 17 if (!callback.is_null())
16 callback.Run(args.dump_guid, false /* success */); 18 callback.Run(args.dump_guid, false /* success */);
17 } 19 }
18 } // namespace 20 } // namespace
(...skipping 23 matching lines...) Expand all
42 ctmf_ = ctmf; 44 ctmf_ = ctmf;
43 45
44 { 46 {
45 base::AutoLock lock(lock_); 47 base::AutoLock lock(lock_);
46 ctmf_task_runner_ = task_runner; 48 ctmf_task_runner_ = task_runner;
47 } 49 }
48 50
49 if (ctmf) { 51 if (ctmf) {
50 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( 52 base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
51 this /* delegate */, false /* is_coordinator */); 53 this /* delegate */, false /* is_coordinator */);
54
55 #if !defined(OS_LINUX) && !defined(OS_NACL)
56 // On linux the browser process takes care of dumping process metrics.
57 // The child process is not allowed to do so due to BPF sandbox.
58 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess(
59 base::kNullProcessId);
60 #endif
52 } 61 }
53 } 62 }
54 63
55 // Invoked in child processes by the MemoryDumpManager. 64 // Invoked in child processes by the MemoryDumpManager.
56 void ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump( 65 void ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump(
57 const base::trace_event::MemoryDumpRequestArgs& args, 66 const base::trace_event::MemoryDumpRequestArgs& args,
58 const base::trace_event::MemoryDumpCallback& callback) { 67 const base::trace_event::MemoryDumpCallback& callback) {
59 // RequestGlobalMemoryDump can be called on any thread, cannot access 68 // RequestGlobalMemoryDump can be called on any thread, cannot access
60 // ctmf_task_runner_ as it could be racy. 69 // ctmf_task_runner_ as it could be racy.
61 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner; 70 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner;
(...skipping 26 matching lines...) Expand all
88 97
89 // Send the request up to the browser process' MessageDumpmanager. 98 // Send the request up to the browser process' MessageDumpmanager.
90 ctmf_->SendGlobalMemoryDumpRequest(args, callback); 99 ctmf_->SendGlobalMemoryDumpRequest(args, callback);
91 } 100 }
92 101
93 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { 102 uint64_t ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const {
94 return tracing_process_id_; 103 return tracing_process_id_;
95 } 104 }
96 105
97 } // namespace tracing 106 } // namespace tracing
OLDNEW
« no previous file with comments | « components/tracing/BUILD.gn ('k') | components/tracing/process_metrics_memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698