Index: tracing/tracing/extras/importer/legacy_heap_dump_trace_event_importer.html |
diff --git a/tracing/tracing/extras/importer/heap_dump_trace_event_importer.html b/tracing/tracing/extras/importer/legacy_heap_dump_trace_event_importer.html |
similarity index 88% |
copy from tracing/tracing/extras/importer/heap_dump_trace_event_importer.html |
copy to tracing/tracing/extras/importer/legacy_heap_dump_trace_event_importer.html |
index e11e40313f0e369e517640e1ed1fb1862d6b7e64..32a38740729ff5af72cf13e486b5de6ec439d7d0 100644 |
--- a/tracing/tracing/extras/importer/heap_dump_trace_event_importer.html |
+++ b/tracing/tracing/extras/importer/legacy_heap_dump_trace_event_importer.html |
@@ -1,4 +1,5 @@ |
<!DOCTYPE html> |
+ |
<!-- |
Copyright 2016 The Chromium Authors. All rights reserved. |
Use of this source code is governed by a BSD-style license that can be |
@@ -25,18 +26,26 @@ tr.exportTo('tr.e.importer', function() { |
* trace id before looking it up in the model. |
* @param {!string} dumpId |
* Raw heap dump id, used only for nice error messages. |
+ * @param {!Object} rawHeapDumps |
+ * Raw heap dump. |
*/ |
- function HeapDumpTraceEventImporter( |
- model, processMemoryDump, processObjectTypeNameMap, idPrefix, dumpId) { |
+ function LegacyHeapDumpTraceEventImporter( |
+ model, |
+ processMemoryDump, |
+ processObjectTypeNameMap, |
+ idPrefix, |
+ dumpId, |
+ rawHeapDumps) { |
this.model_ = model; |
this.processObjectTypeNameMap_ = processObjectTypeNameMap; |
this.idPrefix_ = idPrefix; |
this.processMemoryDump_ = processMemoryDump; |
this.pid_ = this.processMemoryDump_.process.pid; |
this.dumpId_ = dumpId; |
+ this.rawHeapDumps_ = rawHeapDumps; |
} |
- HeapDumpTraceEventImporter.prototype = { |
+ LegacyHeapDumpTraceEventImporter.prototype = { |
/** |
* Parse rawHeapDump and add entries to heapDump. |
* |
@@ -179,10 +188,27 @@ tr.exportTo('tr.e.importer', function() { |
return heapDump; |
}, |
+ |
+ parse() { |
+ const heapDumps = {}; |
+ for (const allocatorName in this.rawHeapDumps_) { |
+ const rawHeapDump = this.rawHeapDumps_[allocatorName]; |
+ const heapDump = this.parseRawHeapDump(rawHeapDump, allocatorName); |
+ |
+ // Throw away heap dumps with no entries. This can happen if all raw |
+ // entries in the trace are skipped for some reason (e.g. invalid leaf |
+ // stack frame ID). |
+ if (heapDump !== undefined && heapDump.entries.length > 0) { |
+ heapDumps[allocatorName] = heapDump; |
+ } |
+ } |
+ return heapDumps; |
+ }, |
+ |
}; |
return { |
- HeapDumpTraceEventImporter, |
+ LegacyHeapDumpTraceEventImporter, |
}; |
}); |
</script> |