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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Address comments (heaps_v2) 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/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_session_state.h » ('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 5a54a773c5e4eb8b7eb816000855e23dc0374780..ee2325eb5a42ba3cf9bf2cb089b77bce923831a9 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -22,8 +22,7 @@
#include "base/trace_event/heap_profiler.h"
#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
#include "base/trace_event/heap_profiler_event_filter.h"
-#include "base/trace_event/heap_profiler_stack_frame_deduplicator.h"
-#include "base/trace_event/heap_profiler_type_name_deduplicator.h"
+#include "base/trace_event/heap_profiler_event_writer.h"
#include "base/trace_event/malloc_dump_provider.h"
#include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_scheduler.h"
@@ -90,33 +89,6 @@ void OnGlobalDumpDone(MemoryDumpCallback wrapped_callback,
}
}
-// Proxy class which wraps a ConvertableToTraceFormat owned by the
-// |session_state| into a proxy object that can be added to the trace event log.
-// This is to solve the problem that the MemoryDumpSessionState is refcounted
-// but the tracing subsystem wants a std::unique_ptr<ConvertableToTraceFormat>.
-template <typename T>
-struct SessionStateConvertableProxy : public ConvertableToTraceFormat {
- using GetterFunctPtr = T* (MemoryDumpSessionState::*)() const;
-
- SessionStateConvertableProxy(
- scoped_refptr<MemoryDumpSessionState> session_state,
- GetterFunctPtr getter_function)
- : session_state(session_state), getter_function(getter_function) {}
-
- void AppendAsTraceFormat(std::string* out) const override {
- return (session_state.get()->*getter_function)()->AppendAsTraceFormat(out);
- }
-
- void EstimateTraceMemoryOverhead(
- TraceEventMemoryOverhead* overhead) override {
- return (session_state.get()->*getter_function)()
- ->EstimateTraceMemoryOverhead(overhead);
- }
-
- scoped_refptr<MemoryDumpSessionState> session_state;
- GetterFunctPtr const getter_function;
-};
-
} // namespace
// static
@@ -807,26 +779,11 @@ void MemoryDumpManager::OnTraceLogEnabled() {
session_state->set_heap_profiler_breakdown_threshold_bytes(
memory_dump_config.heap_profiler_options.breakdown_threshold_bytes);
if (heap_profiling_enabled_) {
- // If heap profiling is enabled, the stack frame deduplicator and type name
- // deduplicator will be in use. Add a metadata events to write the frames
- // and type IDs.
- session_state->SetStackFrameDeduplicator(
- WrapUnique(new StackFrameDeduplicator));
-
- session_state->SetTypeNameDeduplicator(
- WrapUnique(new TypeNameDeduplicator));
-
- TRACE_EVENT_API_ADD_METADATA_EVENT(
- TraceLog::GetCategoryGroupEnabled("__metadata"), "stackFrames",
- "stackFrames",
- MakeUnique<SessionStateConvertableProxy<StackFrameDeduplicator>>(
- session_state, &MemoryDumpSessionState::stack_frame_deduplicator));
-
- TRACE_EVENT_API_ADD_METADATA_EVENT(
- TraceLog::GetCategoryGroupEnabled("__metadata"), "typeNames",
- "typeNames",
- MakeUnique<SessionStateConvertableProxy<TypeNameDeduplicator>>(
- session_state, &MemoryDumpSessionState::type_name_deduplicator));
+ // TODO(dskiba): support continuous mode (crbug.com/701052)
+ LOG_IF(ERROR, trace_config.GetTraceRecordMode() != RECORD_CONTINUOUSLY)
+ << "Heap profile format is incremental and doesn't yet support "
+ << "continuous mode.";
+ session_state->CreateDeduplicators();
}
std::unique_ptr<MemoryDumpScheduler> dump_scheduler(
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_session_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698