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_REMOTE_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_METRICS_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_remote.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 LeakDetectorRemote { | |
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 { | |
jochen (gone - plz use gerrit)
2016/06/08 15:01:11
virtual dtor please
Simon Que
2016/06/08 22:31:13
Done.
| |
26 public: | |
27 // Returns a set of leak detection params to be used when initializing the | |
28 // leak detector on a remote process. | |
29 virtual MemoryLeakReportProto::Params GetParams() const = 0; | |
30 | |
31 // Pass a vector of memory leak reports provided by a remote process to the | |
32 // local controller class. | |
33 virtual void SendLeakReports( | |
34 const std::vector<MemoryLeakReportProto>& reports) = 0; | |
35 }; | |
36 | |
37 ~LeakDetectorRemoteController() override; | |
38 | |
39 static void Create(LeakDetectorRemoteRequest request); | |
40 | |
41 // LeakDetectorRemote: | |
42 void GetParams( | |
43 const LeakDetectorRemote::GetParamsCallback& callback) override; | |
44 void SendLeakReports(mojo::Array<mojo::String>) override; | |
45 | |
46 // Sets a global pointer to a LocalController implementation. The global | |
47 // pointer is defined in the .cc file. | |
48 static void SetLocalControllerInstance(LocalController* controller); | |
49 | |
50 private: | |
51 explicit LeakDetectorRemoteController(LeakDetectorRemoteRequest request); | |
52 | |
53 mojo::StrongBinding<metrics::LeakDetectorRemote> binding_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController); | |
56 }; | |
57 | |
58 } // namespace metrics | |
59 | |
60 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_REMOTE_CONTROLLER_H_ | |
OLD | NEW |