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

Unified Diff: base/trace_event/sharded_allocation_register.h

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Sharded rebase Created 3 years, 7 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/sharded_allocation_register.h
diff --git a/base/trace_event/sharded_allocation_register.h b/base/trace_event/sharded_allocation_register.h
index bba1eeab0c4ab9fc362798dcdd5b8c483333a68b..9c3337bb39be4a30106edfa4dc3c480f2339f75f 100644
--- a/base/trace_event/sharded_allocation_register.h
+++ b/base/trace_event/sharded_allocation_register.h
@@ -11,6 +11,7 @@
#include "base/atomicops.h"
#include "base/base_export.h"
+#include "base/callback.h"
#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "base/trace_event/heap_profiler_allocation_register.h"
@@ -25,15 +26,6 @@ class TraceEventMemoryOverhead;
// This container is thread-safe.
class BASE_EXPORT ShardedAllocationRegister {
public:
- using MetricsMap = std::unordered_map<AllocationContext, AllocationMetrics>;
-
- struct OutputMetrics {
- // Total size of allocated objects.
- size_t size;
- // Total count of allocated objects.
- size_t count;
- };
-
ShardedAllocationRegister();
// This class must be enabled before calling Insert() or Remove(). Once the
@@ -61,9 +53,10 @@ class BASE_EXPORT ShardedAllocationRegister {
// Estimates memory overhead including |sizeof(AllocationRegister)|.
void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) const;
- // Updates |map| with all allocated objects and their statistics.
- // Returns aggregate statistics.
- OutputMetrics UpdateAndReturnsMetrics(MetricsMap& map) const;
+ using AllocationVisitor =
+ base::RepeatingCallback<void(const AllocationRegister::Allocation&)>;
+
+ void VisitAllocations(const AllocationVisitor& visitor) const;
private:
struct RegisterAndLock {

Powered by Google App Engine
This is Rietveld 408576698