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() override; |
| 22 |
| 23 // Retrieves all reports in |stored_reports_|, moving them to |*reports|. |
| 24 // |stored_reports_| is empty afterwards. |
| 25 void GetLeakReports(std::vector<MemoryLeakReportProto>* reports); |
| 26 |
| 27 protected: |
| 28 // LeakDetector::Observer: |
| 29 void OnLeakFound(const LeakDetector::LeakReport& report) override; |
| 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 |