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

Side by Side Diff: components/metrics/leak_detector/protobuf_to_mojo_converter.cc

Issue 2417403002: Revert of Leak reports collect information about the last uptrend (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/leak_detector/protobuf_to_mojo_converter.h" 5 #include "components/metrics/leak_detector/protobuf_to_mojo_converter.h"
6 6
7 namespace metrics { 7 namespace metrics {
8 namespace leak_detector { 8 namespace leak_detector {
9 namespace protobuf_to_mojo_converter { 9 namespace protobuf_to_mojo_converter {
10 10
(...skipping 13 matching lines...) Expand all
24 params->set_max_stack_depth(mojo_params.max_stack_depth); 24 params->set_max_stack_depth(mojo_params.max_stack_depth);
25 params->set_analysis_interval_bytes(mojo_params.analysis_interval_bytes); 25 params->set_analysis_interval_bytes(mojo_params.analysis_interval_bytes);
26 params->set_size_suspicion_threshold(mojo_params.size_suspicion_threshold); 26 params->set_size_suspicion_threshold(mojo_params.size_suspicion_threshold);
27 params->set_call_stack_suspicion_threshold( 27 params->set_call_stack_suspicion_threshold(
28 mojo_params.call_stack_suspicion_threshold); 28 mojo_params.call_stack_suspicion_threshold);
29 } 29 }
30 30
31 void ReportToMojo(const MemoryLeakReportProto& report, 31 void ReportToMojo(const MemoryLeakReportProto& report,
32 mojom::MemoryLeakReport* mojo_report) { 32 mojom::MemoryLeakReport* mojo_report) {
33 mojo_report->size_bytes = report.size_bytes(); 33 mojo_report->size_bytes = report.size_bytes();
34 mojo_report->num_rising_intervals = report.num_rising_intervals();
35 mojo_report->num_allocs_increase = report.num_allocs_increase();
36 for (auto call_stack_value : report.call_stack()) { 34 for (auto call_stack_value : report.call_stack()) {
37 mojo_report->call_stack.push_back(call_stack_value); 35 mojo_report->call_stack.push_back(call_stack_value);
38 } 36 }
39 37
40 for (const auto& history_entry : report.alloc_breakdown_history()) { 38 for (const auto& history_entry : report.alloc_breakdown_history()) {
41 metrics::mojom::AllocationBreakdownPtr mojo_entry = 39 metrics::mojom::AllocationBreakdownPtr mojo_entry =
42 metrics::mojom::AllocationBreakdown::New(); 40 metrics::mojom::AllocationBreakdown::New();
43 for (auto count : history_entry.counts_by_size()) { 41 for (auto count : history_entry.counts_by_size()) {
44 mojo_entry->counts_by_size.push_back(count); 42 mojo_entry->counts_by_size.push_back(count);
45 } 43 }
46 mojo_entry->count_for_call_stack = history_entry.count_for_call_stack(); 44 mojo_entry->count_for_call_stack = history_entry.count_for_call_stack();
47 45
48 mojo_report->alloc_breakdown_history.push_back(std::move(mojo_entry)); 46 mojo_report->alloc_breakdown_history.push_back(std::move(mojo_entry));
49 } 47 }
50 } 48 }
51 49
52 void MojoToReport(const mojom::MemoryLeakReport& mojo_report, 50 void MojoToReport(const mojom::MemoryLeakReport& mojo_report,
53 MemoryLeakReportProto* report) { 51 MemoryLeakReportProto* report) {
54 report->set_size_bytes(mojo_report.size_bytes); 52 report->set_size_bytes(mojo_report.size_bytes);
55 report->set_num_rising_intervals(mojo_report.num_rising_intervals);
56 report->set_num_allocs_increase(mojo_report.num_allocs_increase);
57 for (auto call_stack_addr : mojo_report.call_stack) 53 for (auto call_stack_addr : mojo_report.call_stack)
58 report->add_call_stack(call_stack_addr); 54 report->add_call_stack(call_stack_addr);
59 55
60 for (const auto& history_entry : mojo_report.alloc_breakdown_history) { 56 for (const auto& history_entry : mojo_report.alloc_breakdown_history) {
61 auto proto_entry = report->add_alloc_breakdown_history(); 57 auto proto_entry = report->add_alloc_breakdown_history();
62 for (auto count : history_entry->counts_by_size) { 58 for (auto count : history_entry->counts_by_size) {
63 proto_entry->add_counts_by_size(count); 59 proto_entry->add_counts_by_size(count);
64 } 60 }
65 proto_entry->set_count_for_call_stack(history_entry->count_for_call_stack); 61 proto_entry->set_count_for_call_stack(history_entry->count_for_call_stack);
66 } 62 }
67 } 63 }
68 64
69 } // namespace protobuf_to_mojo_converter 65 } // namespace protobuf_to_mojo_converter
70 } // namespace leak_detector 66 } // namespace leak_detector
71 } // namespace metrics 67 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698