Index: components/metrics/leak_detector/leak_detector.cc |
diff --git a/components/metrics/leak_detector/leak_detector.cc b/components/metrics/leak_detector/leak_detector.cc |
index d1ae9c49527eeac10467719144157374895e09d4..c41091128fbdc04b43ef78412af278958d43b92f 100644 |
--- a/components/metrics/leak_detector/leak_detector.cc |
+++ b/components/metrics/leak_detector/leak_detector.cc |
@@ -6,6 +6,8 @@ |
#include <stdint.h> |
+#include <algorithm> // For std::transform |
Ilya Sherman
2016/04/13 00:07:12
nit: I'd omit the comment, since it's likely to dr
Ilya Sherman
2016/04/13 00:07:12
... though, actually, you don't seem to use std::t
Simon Que
2016/04/13 22:41:31
Yes, I forgot to delete it when I no longer used i
|
+ |
#include "base/allocator/allocator_extension.h" |
#include "base/bind.h" |
#include "base/lazy_instance.h" |
@@ -118,6 +120,17 @@ void GetReportsForObservers( |
memcpy(new_report->call_stack.data(), report.call_stack().data(), |
report.call_stack().size() * sizeof(report.call_stack()[0])); |
} |
+ |
+ new_report->alloc_breakdown_history.reserve( |
+ report.alloc_breakdown_history().size()); |
Ilya Sherman
2016/04/13 00:07:12
I think you can skip this reserve() call, unless t
Simon Que
2016/04/13 22:41:31
Done.
|
+ for (const auto& entry : report.alloc_breakdown_history()) { |
+ LeakReport::AllocationBreakdown new_entry; |
+ new_entry.counts_by_size.reserve(entry.counts_by_size.size()); |
Ilya Sherman
2016/04/13 00:07:12
Ditto here, especially since you write the vector
Simon Que
2016/04/13 22:41:31
Done.
|
+ new_entry.counts_by_size.assign(entry.counts_by_size.begin(), |
+ entry.counts_by_size.end()); |
+ new_entry.count_for_call_stack = entry.count_for_call_stack; |
+ new_report->alloc_breakdown_history.push_back(new_entry); |
+ } |
} |
} |
@@ -153,6 +166,11 @@ inline void StoreHookDataToTLS(HookData hook_data) { |
} // namespace |
+LeakDetector::LeakReport::AllocationBreakdown::AllocationBreakdown() |
+ : count_for_call_stack(0) {} |
+ |
+LeakDetector::LeakReport::AllocationBreakdown::~AllocationBreakdown() {} |
+ |
LeakDetector::LeakReport::LeakReport() {} |
LeakDetector::LeakReport::~LeakReport() {} |