Chromium Code Reviews| Index: chrome/browser/metrics/leak_detector_controller.cc |
| diff --git a/chrome/browser/metrics/leak_detector_controller.cc b/chrome/browser/metrics/leak_detector_controller.cc |
| index 06762ea035777b276d120c7f8b9b130795750397..3b26224d3aacddadf5dfaf0242564a56c22220e2 100644 |
| --- a/chrome/browser/metrics/leak_detector_controller.cc |
| +++ b/chrome/browser/metrics/leak_detector_controller.cc |
| @@ -105,20 +105,19 @@ LeakDetectorController::~LeakDetectorController() { |
| LeakDetector::GetInstance()->RemoveObserver(this); |
| } |
| -void LeakDetectorController::OnLeakFound( |
| - const LeakDetector::LeakReport& report) { |
| +void LeakDetectorController::OnLeaksFound( |
| + const std::vector<MemoryLeakReportProto>& reports) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - // Initialize the new report with the protobuf template, which contains some |
| - // pre-filled data (parameter values). |
| - stored_reports_.push_back(leak_report_proto_template_); |
| - MemoryLeakReportProto* proto = &stored_reports_.back(); |
| + for (const auto& report : reports) { |
| + // Initialize the new report with the protobuf template, which contains some |
| + // pre-filled data (parameter values). |
| + stored_reports_.push_back(leak_report_proto_template_); |
| + MemoryLeakReportProto* proto = &stored_reports_.back(); |
| - // Fill in the remaining fields of the protobuf with data from |report|. |
| - proto->set_size_bytes(report.alloc_size_bytes); |
| - proto->mutable_call_stack()->Reserve(report.call_stack.size()); |
| - for (uintptr_t call_stack_entry : report.call_stack) |
| - proto->mutable_call_stack()->Add(call_stack_entry); |
| + // Merge in the other fields. |
| + proto->CheckTypeAndMergeFrom(report); |
|
Ilya Sherman
2016/04/14 01:08:45
Hmm, is the "CheckTypeAnd" prefix necessary? That
Simon Que
2016/04/14 01:24:30
I thought it was not available because MemoryLeakR
Ilya Sherman
2016/04/14 02:30:04
Yeah, the API docs on that site are not the cleare
|
| + } |
| } |
| void LeakDetectorController::GetLeakReports( |