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_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 { |
| 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 |
| 39 ~LeakDetectorRemoteController() override; |
| 40 |
| 41 static void Create(LeakDetectorRemoteRequest request); |
| 42 |
| 43 // LeakDetectorRemote: |
| 44 void GetParams( |
| 45 const LeakDetectorRemote::GetParamsCallback& callback) override; |
| 46 void SendLeakReports(mojo::Array<mojo::String>) override; |
| 47 |
| 48 // Sets a global pointer to a LocalController implementation. The global |
| 49 // pointer is defined in the .cc file. |
| 50 static void SetLocalControllerInstance(LocalController* controller); |
| 51 |
| 52 private: |
| 53 explicit LeakDetectorRemoteController(LeakDetectorRemoteRequest request); |
| 54 |
| 55 mojo::StrongBinding<metrics::LeakDetectorRemote> binding_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController); |
| 58 }; |
| 59 |
| 60 } // namespace metrics |
| 61 |
| 62 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_LEAK_DETECTOR_REMOTE_CONTROLLER_
H_ |
OLD | NEW |