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

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

Issue 1333873002: [tracing] Fix MemoryDumpManager to support startup tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re dsinclair #5 (nits, invert Initialize args) Created 5 years, 3 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 "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 "components/tracing/child_trace_message_filter.h" 8 #include "components/tracing/child_trace_message_filter.h"
9 9
10 namespace tracing { 10 namespace tracing {
11 11
12 // static 12 // static
13 ChildMemoryDumpManagerDelegateImpl* 13 ChildMemoryDumpManagerDelegateImpl*
14 ChildMemoryDumpManagerDelegateImpl::GetInstance() { 14 ChildMemoryDumpManagerDelegateImpl::GetInstance() {
15 return Singleton< 15 return Singleton<
16 ChildMemoryDumpManagerDelegateImpl, 16 ChildMemoryDumpManagerDelegateImpl,
17 LeakySingletonTraits<ChildMemoryDumpManagerDelegateImpl>>::get(); 17 LeakySingletonTraits<ChildMemoryDumpManagerDelegateImpl>>::get();
18 } 18 }
19 19
20 ChildMemoryDumpManagerDelegateImpl::ChildMemoryDumpManagerDelegateImpl() 20 ChildMemoryDumpManagerDelegateImpl::ChildMemoryDumpManagerDelegateImpl()
21 : ctmf_(nullptr), 21 : ctmf_(nullptr),
22 tracing_process_id_( 22 tracing_process_id_(
23 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId) { 23 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId) {
24 base::trace_event::MemoryDumpManager::GetInstance()->SetDelegate(this); 24 base::trace_event::MemoryDumpManager::GetInstance()->Initialize(
25 this /* delegate */, false /* is_coordinator */);
25 } 26 }
26 27
27 ChildMemoryDumpManagerDelegateImpl::~ChildMemoryDumpManagerDelegateImpl() { 28 ChildMemoryDumpManagerDelegateImpl::~ChildMemoryDumpManagerDelegateImpl() {}
28 }
29 29
30 void ChildMemoryDumpManagerDelegateImpl::SetChildTraceMessageFilter( 30 void ChildMemoryDumpManagerDelegateImpl::SetChildTraceMessageFilter(
31 ChildTraceMessageFilter* ctmf) { 31 ChildTraceMessageFilter* ctmf) {
32 // Check that we are either registering the CTMF or tearing it down, but not 32 // Check that we are either registering the CTMF or tearing it down, but not
33 // replacing a valid instance with another one (should never happen). 33 // replacing a valid instance with another one (should never happen).
34 DCHECK(ctmf_ == nullptr || (ctmf == nullptr && ctmf_task_runner_ != nullptr)); 34 DCHECK(ctmf_ == nullptr || (ctmf == nullptr && ctmf_task_runner_ != nullptr));
35 ctmf_ = ctmf; 35 ctmf_ = ctmf;
36 ctmf_task_runner_ = ctmf ? (ctmf->ipc_task_runner()) : nullptr; 36 ctmf_task_runner_ = ctmf ? (ctmf->ipc_task_runner()) : nullptr;
37 } 37 }
38 38
(...skipping 24 matching lines...) Expand all
63 if (!ctmf_) { 63 if (!ctmf_) {
64 if (!callback.is_null()) 64 if (!callback.is_null())
65 callback.Run(args.dump_guid, false /* success */); 65 callback.Run(args.dump_guid, false /* success */);
66 return; 66 return;
67 } 67 }
68 68
69 // Send the request up to the browser process' MessageDumpmanager. 69 // Send the request up to the browser process' MessageDumpmanager.
70 ctmf_->SendGlobalMemoryDumpRequest(args, callback); 70 ctmf_->SendGlobalMemoryDumpRequest(args, callback);
71 } 71 }
72 72
73 bool ChildMemoryDumpManagerDelegateImpl::IsCoordinatorProcess() const {
74 return false;
75 }
76
77 uint64 ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { 73 uint64 ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const {
78 return tracing_process_id_; 74 return tracing_process_id_;
79 } 75 }
80 76
81 } // namespace tracing 77 } // namespace tracing
OLDNEW
« no previous file with comments | « components/tracing/child_memory_dump_manager_delegate_impl.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698