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_LEAK_DETECTOR_REMOTE_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "components/metrics/leak_detector/leak_detector.mojom.h" | |
13 #include "components/metrics/proto/memory_leak_report.pb.h" | |
14 #include "mojo/public/cpp/bindings/interface_request.h" | |
15 #include "mojo/public/cpp/bindings/strong_binding.h" | |
16 | |
17 namespace metrics { | |
18 | |
19 // This class acts as an interface to LeakDetector clients running on processes | |
20 // other than its own (the browser process). | |
21 class LeakDetectorRemoteController : public mojom::LeakDetector { | |
22 public: | |
23 // Interface class to be implemented by a local controller class that provides | |
24 // leak detector parameters and can pass leak reports to UMA. | |
25 class LocalController { | |
26 public: | |
27 virtual ~LocalController() {} | |
28 | |
29 // Returns a set of leak detection params to be used when initializing the | |
30 // leak detector on a remote process. | |
31 virtual MemoryLeakReportProto::Params GetParams() const = 0; | |
32 | |
33 // Pass a vector of memory leak reports provided by a remote process to the | |
34 // local controller class. | |
35 virtual void SendLeakReports( | |
36 const std::vector<MemoryLeakReportProto>& reports) = 0; | |
37 | |
38 // Signal that a remote process that had been running the leak detector | |
39 // (i.e. been given params with sampling_rate = 0). | |
40 virtual void OnRemoteProcessShutdown() = 0; | |
41 }; | |
42 | |
43 ~LeakDetectorRemoteController() override; | |
44 | |
45 static void Create(mojom::LeakDetectorRequest request); | |
46 | |
47 // mojom::LeakDetector: | |
48 void GetParams( | |
49 const mojom::LeakDetector::GetParamsCallback& callback) override; | |
50 void SendLeakReports(mojo::Array<mojom::MemoryLeakReportPtr>) override; | |
51 | |
52 // Sets a global pointer to a LocalController implementation. The global | |
53 // pointer is defined in the .cc file. | |
54 static void SetLocalControllerInstance(LocalController* controller); | |
jochen (gone - plz use gerrit)
2016/07/18 11:40:55
where is this called from?
Simon Que
2016/07/18 18:50:21
Currently not being called. In a subsequent CL, th
| |
55 | |
56 private: | |
57 explicit LeakDetectorRemoteController(mojom::LeakDetectorRequest request); | |
58 | |
59 mojo::StrongBinding<mojom::LeakDetector> binding_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController); | |
62 }; | |
63 | |
64 } // namespace metrics | |
65 | |
66 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_ H_ | |
OLD | NEW |