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

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

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 "mojo/public/cpp/bindings/strong_binding.h"
16 15
17 namespace metrics { 16 namespace metrics {
18 17
19 // This class acts as an interface to LeakDetector clients running on processes 18 // This class acts as an interface to LeakDetector clients running on processes
20 // other than its own (the browser process). 19 // other than its own (the browser process).
21 class LeakDetectorRemoteController : public mojom::LeakDetector { 20 class LeakDetectorRemoteController : public mojom::LeakDetector {
22 public: 21 public:
23 // Interface class to be implemented by a local controller class that provides 22 // Interface class to be implemented by a local controller class that provides
24 // leak detector parameters and can pass leak reports to UMA. 23 // leak detector parameters and can pass leak reports to UMA.
25 class LocalController { 24 class LocalController {
(...skipping 23 matching lines...) Expand all
49 // mojom::LeakDetector: 48 // mojom::LeakDetector:
50 void GetParams( 49 void GetParams(
51 const mojom::LeakDetector::GetParamsCallback& callback) override; 50 const mojom::LeakDetector::GetParamsCallback& callback) override;
52 void SendLeakReports(std::vector<mojom::MemoryLeakReportPtr>) override; 51 void SendLeakReports(std::vector<mojom::MemoryLeakReportPtr>) override;
53 52
54 // Sets a global pointer to a LocalController implementation. The global 53 // Sets a global pointer to a LocalController implementation. The global
55 // pointer is defined in the .cc file. 54 // pointer is defined in the .cc file.
56 static void SetLocalControllerInstance(LocalController* controller); 55 static void SetLocalControllerInstance(LocalController* controller);
57 56
58 private: 57 private:
59 explicit LeakDetectorRemoteController(mojom::LeakDetectorRequest request); 58 LeakDetectorRemoteController();
60 59
61 // Gets called when the remote process terminates and the Mojo connection gets 60 // Gets called when the remote process terminates and the Mojo connection gets
62 // closed as a result. 61 // closed as a result.
63 void OnRemoteProcessShutdown(); 62 void OnRemoteProcessShutdown();
64 63
65 mojo::StrongBinding<mojom::LeakDetector> binding_;
66
67 // Indicates whether remote process received MemoryLeakReportProto::Params 64 // Indicates whether remote process received MemoryLeakReportProto::Params
68 // with a non-zero sampling rate, i.e. enabled leak detector. 65 // with a non-zero sampling rate, i.e. enabled leak detector.
69 bool leak_detector_enabled_on_remote_process_; 66 bool leak_detector_enabled_on_remote_process_;
70 67
71 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController); 68 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController);
72 }; 69 };
73 70
74 } // namespace metrics 71 } // namespace metrics
75 72
76 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_ H_ 73 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698