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

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

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 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_REMOTE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_H_
6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_H_ 6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/metrics/leak_detector/leak_detector.mojom.h" 12 #include "components/metrics/leak_detector/leak_detector.mojom.h"
13 #include "components/metrics/proto/memory_leak_report.pb.h" 13 #include "components/metrics/proto/memory_leak_report.pb.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "services/service_manager/public/cpp/bind_source_info.h"
15 16
16 namespace metrics { 17 namespace metrics {
17 18
18 // This class acts as an interface to LeakDetector clients running on processes 19 // This class acts as an interface to LeakDetector clients running on processes
19 // other than its own (the browser process). 20 // other than its own (the browser process).
20 class LeakDetectorRemoteController : public mojom::LeakDetector { 21 class LeakDetectorRemoteController : public mojom::LeakDetector {
21 public: 22 public:
22 // Interface class to be implemented by a local controller class that provides 23 // Interface class to be implemented by a local controller class that provides
23 // leak detector parameters and can pass leak reports to UMA. 24 // leak detector parameters and can pass leak reports to UMA.
24 class LocalController { 25 class LocalController {
(...skipping 11 matching lines...) Expand all
36 virtual void SendLeakReports( 37 virtual void SendLeakReports(
37 const std::vector<MemoryLeakReportProto>& reports) = 0; 38 const std::vector<MemoryLeakReportProto>& reports) = 0;
38 39
39 // Signal that a remote process that had been running the leak detector 40 // Signal that a remote process that had been running the leak detector
40 // (i.e. been given params with sampling_rate = 0). 41 // (i.e. been given params with sampling_rate = 0).
41 virtual void OnRemoteProcessShutdown() = 0; 42 virtual void OnRemoteProcessShutdown() = 0;
42 }; 43 };
43 44
44 ~LeakDetectorRemoteController() override; 45 ~LeakDetectorRemoteController() override;
45 46
46 static void Create(mojom::LeakDetectorRequest request); 47 static void Create(const service_manager::BindSourceInfo& source_info,
48 mojom::LeakDetectorRequest request);
47 49
48 // mojom::LeakDetector: 50 // mojom::LeakDetector:
49 void GetParams( 51 void GetParams(
50 const mojom::LeakDetector::GetParamsCallback& callback) override; 52 const mojom::LeakDetector::GetParamsCallback& callback) override;
51 void SendLeakReports(std::vector<mojom::MemoryLeakReportPtr>) override; 53 void SendLeakReports(std::vector<mojom::MemoryLeakReportPtr>) override;
52 54
53 // Sets a global pointer to a LocalController implementation. The global 55 // Sets a global pointer to a LocalController implementation. The global
54 // pointer is defined in the .cc file. 56 // pointer is defined in the .cc file.
55 static void SetLocalControllerInstance(LocalController* controller); 57 static void SetLocalControllerInstance(LocalController* controller);
56 58
57 private: 59 private:
58 LeakDetectorRemoteController(); 60 LeakDetectorRemoteController();
59 61
60 // Gets called when the remote process terminates and the Mojo connection gets 62 // Gets called when the remote process terminates and the Mojo connection gets
61 // closed as a result. 63 // closed as a result.
62 void OnRemoteProcessShutdown(); 64 void OnRemoteProcessShutdown();
63 65
64 // Indicates whether remote process received MemoryLeakReportProto::Params 66 // Indicates whether remote process received MemoryLeakReportProto::Params
65 // with a non-zero sampling rate, i.e. enabled leak detector. 67 // with a non-zero sampling rate, i.e. enabled leak detector.
66 bool leak_detector_enabled_on_remote_process_; 68 bool leak_detector_enabled_on_remote_process_;
67 69
68 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController); 70 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController);
69 }; 71 };
70 72
71 } // namespace metrics 73 } // namespace metrics
72 74
73 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_ H_ 75 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698