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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2820433005: memory-infra: Start disentangling tracing from memory-infra (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
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 7e62064ec6a08e25fcdbc0f79cb3065ed36b1e4a..beb8ceb1b2c5757c5ef92bbec3d7b4d9959a61fd 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -35,6 +35,7 @@
#include "base/trace_event/memory_dump_session_state.h"
#include "base/trace_event/memory_infra_background_whitelist.h"
#include "base/trace_event/memory_peak_detector.h"
+#include "base/trace_event/memory_tracing_frontend.h"
ssid 2017/04/14 23:33:09 Feels like this dependency shouldn't exist?
hjd 2017/04/19 09:54:56 Acknowledged. See message.
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
@@ -198,7 +199,6 @@ MemoryDumpManager::MemoryDumpManager()
}
MemoryDumpManager::~MemoryDumpManager() {
- TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
}
void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
@@ -288,15 +288,6 @@ void MemoryDumpManager::Initialize(
TraceLog::GetInstance()->SetEnabled(filtering_trace_config,
TraceLog::FILTERING_MODE);
}
-
- // If tracing was enabled before initializing MemoryDumpManager, we missed the
- // OnTraceLogEnabled() event. Synthetize it so we can late-join the party.
- // IsEnabled is called before adding observer to avoid calling
- // OnTraceLogEnabled twice.
- bool is_tracing_already_enabled = TraceLog::GetInstance()->IsEnabled();
- TraceLog::GetInstance()->AddEnabledStateObserver(this);
- if (is_tracing_already_enabled)
- OnTraceLogEnabled();
}
void MemoryDumpManager::RegisterDumpProvider(
@@ -792,14 +783,6 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
}
}
- bool tracing_still_enabled;
- TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &tracing_still_enabled);
- if (!tracing_still_enabled) {
- pmd_async_state->dump_successful = false;
- VLOG(1) << kLogPrefix << " failed because tracing was disabled before"
- << " the dump was completed";
- }
hjd 2017/04/13 14:16:59 Can we just remove this now?
ssid 2017/04/14 23:33:09 I think this can be removed along with TRACE_EVENT
hjd 2017/04/19 09:54:56 Okay, I've moved TRACE_EVENT_API_ADD_TRACE_EVENT_W
-
if (!pmd_async_state->callback.is_null()) {
pmd_async_state->callback.Run(dump_guid, pmd_async_state->dump_successful);
pmd_async_state->callback.Reset();
@@ -809,12 +792,7 @@ void MemoryDumpManager::FinalizeDumpAndAddToTrace(
TRACE_ID_LOCAL(dump_guid));
}
-void MemoryDumpManager::OnTraceLogEnabled() {
- bool enabled;
- TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled);
- if (!enabled)
- return;
-
+void MemoryDumpManager::Enable() {
// Initialize the TraceLog for the current thread. This is to avoid that the
// TraceLog memory dump provider is registered lazily in the PostTask() below
// while the |lock_| is taken;
@@ -915,7 +893,7 @@ void MemoryDumpManager::OnTraceLogEnabled() {
}
}
-void MemoryDumpManager::OnTraceLogDisabled() {
+void MemoryDumpManager::Disable() {
// There might be a memory dump in progress while this happens. Therefore,
// ensure that the MDM state which depends on the tracing enabled / disabled
// state is always accessed by the dumping methods holding the |lock_|.

Powered by Google App Engine
This is Rietveld 408576698