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

Side by Side Diff: base/trace_event/heap_profiler_type_name_deduplicator.h

Issue 1467453003: [Tracing] Make heap profiler type info a string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_TYPE_NAME_DEDUPLICATOR_H_
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_TYPE_NAME_DEDUPLICATOR_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/base_export.h"
12 #include "base/macros.h"
13 #include "base/trace_event/trace_event_impl.h"
14
15 namespace base {
16 namespace trace_event {
17
18 class TraceEventMemoryOverhead;
19
20 // Data structure that assigns a unique numeric ID to |const char*|s.
21 class BASE_EXPORT TypeNameDeduplicator : public ConvertableToTraceFormat {
22 public:
23 TypeNameDeduplicator();
24
25 // Inserts a type name and returns its ID.
26 int Insert(const char* type_name);
27
28 // Estimates memory overhead including |sizeof(TypeNameDeduplicator)|.
29 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override;
30
31 private:
32 ~TypeNameDeduplicator() override;
33
34 // Writes the type ID -> type name mapping to the trace log.
35 void AppendAsTraceFormat(std::string* out) const override;
36
37 // Map from type name to type ID.
38 std::map<const char*, int> type_ids_;
39
40 DISALLOW_COPY_AND_ASSIGN(TypeNameDeduplicator);
41 };
42
43 } // namespace trace_event
44 } // namespace base
45
46 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_TYPE_NAME_DEDUPLICATOR_H_
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_heap_dump_writer_unittest.cc ('k') | base/trace_event/heap_profiler_type_name_deduplicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698