Chromium Code Reviews| 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 class LeakDetectorController : public LeakDetector::Observer { | |
| 19 public: | |
| 20 LeakDetectorController(); | |
| 21 ~LeakDetectorController(); | |
| 22 | |
| 23 // Stores a new leak report in |stored_reports_|. | |
|
Alexei Svitkine (slow)
2016/02/12 16:17:42
This comment should just be:
// LeakDetector::Obs
Simon Que
2016/02/12 19:00:07
Will make this change once I know what to do regar
Simon Que
2016/02/17 20:49:33
Done.
| |
| 24 void OnLeakFound(const LeakDetector::LeakReport& report) override; | |
|
Alexei Svitkine (slow)
2016/02/12 16:17:42
Move this to private section.
Simon Que
2016/02/12 19:00:07
What about the unit test? It calls this func. How
Alexei Svitkine (slow)
2016/02/17 16:06:30
Derived class that exposes these functions SGTM.
Simon Que
2016/02/17 20:49:33
Done.
| |
| 25 | |
| 26 // Retrieves all reports in |stored_reports_|, moving them to |*reports|. | |
| 27 // |stored_reports_| is empty afterwards. | |
| 28 void GetLeakReports(std::vector<MemoryLeakReportProto>* reports); | |
| 29 | |
| 30 private: | |
| 31 // Leak detector interface object. | |
| 32 LeakDetector detector_; | |
| 33 | |
| 34 // All leak reports received through OnLeakFound() are stored in protobuf | |
| 35 // format. | |
| 36 std::vector<MemoryLeakReportProto> stored_reports_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(LeakDetectorController); | |
| 39 }; | |
| 40 | |
| 41 } // namespace metrics | |
| 42 | |
| 43 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_CONTROLLER_H_ | |
| OLD | NEW |