 Chromium Code Reviews
 Chromium Code Reviews Issue 2650863003:
  [tracing] Switch to new heap dump format.  (Closed)
    
  
    Issue 2650863003:
  [tracing] Switch to new heap dump format.  (Closed) 
  | Index: base/trace_event/heap_profiler_type_name_deduplicator.h | 
| diff --git a/base/trace_event/heap_profiler_type_name_deduplicator.h b/base/trace_event/heap_profiler_type_name_deduplicator.h | 
| index 2d26c73488ef59b7e7ce8502914a54984d4666f7..070251683332d28a02f972278741c11f9e925e90 100644 | 
| --- a/base/trace_event/heap_profiler_type_name_deduplicator.h | 
| +++ b/base/trace_event/heap_profiler_type_name_deduplicator.h | 
| @@ -7,34 +7,38 @@ | 
| #include <map> | 
| #include <string> | 
| +#include <vector> | 
| #include "base/base_export.h" | 
| #include "base/macros.h" | 
| -#include "base/trace_event/trace_event_impl.h" | 
| namespace base { | 
| namespace trace_event { | 
| class TraceEventMemoryOverhead; | 
| +class TracedValue; | 
| // Data structure that assigns a unique numeric ID to |const char*|s. | 
| -class BASE_EXPORT TypeNameDeduplicator : public ConvertableToTraceFormat { | 
| +class BASE_EXPORT TypeNameDeduplicator { | 
| public: | 
| TypeNameDeduplicator(); | 
| - ~TypeNameDeduplicator() override; | 
| + ~TypeNameDeduplicator(); | 
| // Inserts a type name and returns its ID. | 
| int Insert(const char* type_name); | 
| - // Writes the type ID -> type name mapping to the trace log. | 
| - void AppendAsTraceFormat(std::string* out) const override; | 
| + // Append {ID -> type name} mappings that were added after the last call | 
| + // to this function. | 
| + void AppendIncrementally(TracedValue* traced_value); | 
| // Estimates memory overhead including |sizeof(TypeNameDeduplicator)|. | 
| - void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override; | 
| + void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); | 
| private: | 
| // Map from type name to type ID. | 
| - std::map<const char*, int> type_ids_; | 
| + using TypeMap = std::map<const char*, int>; | 
| + TypeMap type_ids_; | 
| + std::vector<TypeMap::const_iterator> new_type_ids_; | 
| 
Primiano Tucci (use gerrit)
2017/02/17 17:07:05
smart ;-)
 | 
| DISALLOW_COPY_AND_ASSIGN(TypeNameDeduplicator); | 
| }; |