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

Side by Side Diff: chrome/browser/metrics/leak_detector/leak_detector_controller.h

Issue 2166553003: Revert of Mojo interface/service for Leak Detector on remote process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 #ifndef CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_
6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_ 6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "chrome/browser/metrics/leak_detector/leak_detector_remote_controller.h "
13 #include "components/metrics/leak_detector/leak_detector.h" 12 #include "components/metrics/leak_detector/leak_detector.h"
14 #include "components/metrics/proto/memory_leak_report.pb.h" 13 #include "components/metrics/proto/memory_leak_report.pb.h"
15 14
16 namespace metrics { 15 namespace metrics {
17 16
18 // This class initializes the LeakDetector on the browser process and registers 17 // This class initializes the LeakDetector on the browser process and registers
19 // itself to be notified of leak reports. 18 // itself to be notified of leak reports.
20 class LeakDetectorController 19 class LeakDetectorController : public LeakDetector::Observer {
21 : public LeakDetector::Observer,
22 public LeakDetectorRemoteController::LocalController {
23 public: 20 public:
24 LeakDetectorController(); 21 LeakDetectorController();
25 ~LeakDetectorController() override; 22 ~LeakDetectorController() override;
26 23
27 // Retrieves all reports in |stored_reports_|, moving them to |*reports|. 24 // Retrieves all reports in |stored_reports_|, moving them to |*reports|.
28 // |stored_reports_| is empty afterwards. 25 // |stored_reports_| is empty afterwards.
29 void GetLeakReports(std::vector<MemoryLeakReportProto>* reports); 26 void GetLeakReports(std::vector<MemoryLeakReportProto>* reports);
30 27
31 protected: 28 protected:
32 // LeakDetector::Observer: 29 // LeakDetector::Observer:
33 void OnLeaksFound(const std::vector<MemoryLeakReportProto>& reports) override; 30 void OnLeaksFound(const std::vector<MemoryLeakReportProto>& reports) override;
34 31
35 // LeakDetectorRemoteController::LocalController:
36 MemoryLeakReportProto::Params GetParams() const override;
37 void SendLeakReports(
38 const std::vector<MemoryLeakReportProto>& reports) override;
39 void OnRemoteProcessShutdown() override;
40
41 private: 32 private:
42 // Stores a given array of leak reports in |stored_reports_|. |process_type|
43 // is the type of process that generated these reports. The reports must all
44 // come from the same process type.
45 void StoreLeakReports(const std::vector<MemoryLeakReportProto>& reports,
46 MemoryLeakReportProto::ProcessType process_type);
47
48 // All leak reports received through OnLeakFound() are stored in protobuf 33 // All leak reports received through OnLeakFound() are stored in protobuf
49 // format. 34 // format.
50 std::vector<MemoryLeakReportProto> stored_reports_; 35 std::vector<MemoryLeakReportProto> stored_reports_;
51 36
52 // Contains all the parameters passed to LeakDetector. Store them in a single 37 // Contains all the parameters passed to LeakDetector. Store them in a single
53 // protobuf message instead of in separate member variables. 38 // protobuf message instead of in separate member variables.
54 const MemoryLeakReportProto::Params params_; 39 const MemoryLeakReportProto::Params params_;
55 40
56 // For thread safety. 41 // For thread safety.
57 base::ThreadChecker thread_checker_; 42 base::ThreadChecker thread_checker_;
58 43
59 DISALLOW_COPY_AND_ASSIGN(LeakDetectorController); 44 DISALLOW_COPY_AND_ASSIGN(LeakDetectorController);
60 }; 45 };
61 46
62 } // namespace metrics 47 } // namespace metrics
63 48
64 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_ 49 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/metrics/leak_detector/leak_detector_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698