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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2741203002: memory-infra: Finish moving to Mojo (3nd attempt) (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 5f4ec841edae5695c4ae9562c70c153a2ba3efc3..45d448425e9afbf7112e9575aefa6f2a5b2a32bc 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -155,9 +155,7 @@ void MemoryDumpManager::SetInstanceForTesting(MemoryDumpManager* instance) {
}
MemoryDumpManager::MemoryDumpManager()
- : delegate_(nullptr),
- is_coordinator_(false),
- memory_tracing_enabled_(0),
+ : memory_tracing_enabled_(0),
tracing_process_id_(kInvalidTracingProcessId),
dumper_registrations_ignored_for_testing_(false),
heap_profiling_enabled_(false) {
@@ -214,14 +212,13 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
heap_profiling_enabled_ = true;
}
-void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
- bool is_coordinator) {
+void MemoryDumpManager::Initialize(
+ std::unique_ptr<MemoryDumpManagerDelegate> delegate) {
{
AutoLock lock(lock_);
DCHECK(delegate);
DCHECK(!delegate_);
- delegate_ = delegate;
- is_coordinator_ = is_coordinator;
+ delegate_ = std::move(delegate);
EnableHeapProfilingIfNeeded();
}
@@ -460,21 +457,10 @@ void MemoryDumpManager::RequestGlobalDump(
TRACE_ID_MANGLE(guid));
MemoryDumpCallback wrapped_callback = Bind(&OnGlobalDumpDone, callback);
- // Technically there is no need to grab the |lock_| here as the delegate is
- // long-lived and can only be set by Initialize(), which is locked and
- // necessarily happens before memory_tracing_enabled_ == true.
- // Not taking the |lock_|, though, is lakely make TSan barf and, at this point
- // (memory-infra is enabled) we're not in the fast-path anymore.
- MemoryDumpManagerDelegate* delegate;
- {
- AutoLock lock(lock_);
- delegate = delegate_;
- }
-
// The delegate will coordinate the IPC broadcast and at some point invoke
// CreateProcessDump() to get a dump for the current process.
MemoryDumpRequestArgs args = {guid, dump_type, level_of_detail};
- delegate->RequestGlobalMemoryDump(args, wrapped_callback);
+ delegate_->RequestGlobalMemoryDump(args, wrapped_callback);
}
void MemoryDumpManager::RequestGlobalDump(
@@ -876,7 +862,7 @@ void MemoryDumpManager::OnTraceLogEnabled() {
dump_scheduler_->NotifyPollingSupported();
// Only coordinator process triggers periodic global memory dumps.
- if (is_coordinator_)
+ if (delegate_->IsCoordinator())
dump_scheduler_->NotifyPeriodicTriggerSupported();
}
@@ -921,10 +907,6 @@ bool MemoryDumpManager::IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode) {
return session_state_->IsDumpModeAllowed(dump_mode);
}
-uint64_t MemoryDumpManager::GetTracingProcessId() const {
- return delegate_->GetTracingProcessId();
-}
-
MemoryDumpManager::MemoryDumpProviderInfo::MemoryDumpProviderInfo(
MemoryDumpProvider* dump_provider,
const char* name,
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698