OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_METRICS_LEAK_DETECTOR_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_CONTROLLER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/metrics/leak_detector/leak_detector.h" | |
12 #include "components/metrics/proto/memory_leak_report.pb.h" | |
13 | |
14 namespace metrics { | |
15 | |
16 // This class initializes the LeakDetector on the browser process and registers | |
17 // itself to be notified of leak reports. | |
18 | |
Alexei Svitkine (slow)
2016/02/10 20:16:58
Nit: No new line.
Simon Que
2016/02/11 01:45:37
Done.
| |
19 class LeakDetectorController : public LeakDetector::Observer { | |
20 public: | |
21 LeakDetectorController(); | |
22 ~LeakDetectorController(); | |
23 | |
24 // Stores a new leak report in |stored_reports_|. | |
25 void OnLeakFound(const LeakDetector::LeakReport& report) override; | |
26 | |
27 // Retrieves all reports in |stored_reports_|, moving them to |*reports|. | |
28 // |stored_reports_| is empty afterwards. | |
29 void GetLeakReports(std::vector<MemoryLeakReportProto>* reports); | |
30 | |
31 private: | |
32 // Leak detector interface object. | |
33 LeakDetector detector_; | |
34 | |
35 // All leak reports received through OnLeakFound() are stored in protobuf | |
36 // format. | |
37 std::vector<MemoryLeakReportProto> stored_reports_; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(LeakDetectorController); | |
40 }; | |
41 | |
42 } // namespace metrics | |
43 | |
44 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_CONTROLLER_H_ | |
OLD | NEW |