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

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

Issue 2030883004: Add LeakDetectorRemoteController as a Mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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
(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 {
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 void GetParams(MemoryLeakReportProto_Params* params) const = 0;
Ilya Sherman 2016/06/07 23:03:38 Why does this function fill a pointer, rather than
Simon Que 2016/06/08 01:14:18 Done.
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
Ilya Sherman 2016/06/07 23:03:38 nit: Please add a trailing colon, ':'
Simon Que 2016/06/08 01:14:18 Done.
42 void GetParams(const LeakDetectorRemote::GetParamsCallback& cb) override;
43
44 // LeakDetectorRemote
Ilya Sherman 2016/06/07 23:03:38 nit: Please remove this line and the one above (li
Simon Que 2016/06/08 01:14:18 Done.
45 void SendLeakReports(mojo::Array<mojo::String>) override;
46
47 static void SetLocalControllerInstance(LocalController* controller) {
Ilya Sherman 2016/06/07 23:03:38 nit: Please use hacker_case
Simon Que 2016/06/08 01:14:18 Done.
48 controller_ = controller;
49 }
50
51 private:
52 explicit LeakDetectorRemoteController(LeakDetectorRemoteRequest request);
53
54 // Single instance of LocalController. All remote LeakDetector clients will
55 // get their params from and send leak reports to this instance.
56 static LocalController* controller_;
Ilya Sherman 2016/06/07 23:03:38 Optional nit: I think it's slightly preferable to
Simon Que 2016/06/08 01:14:18 Done.
57
58 mojo::StrongBinding<metrics::LeakDetectorRemote> binding_;
59
60 DISALLOW_COPY_AND_ASSIGN(LeakDetectorRemoteController);
61 };
62
63 } // namespace metrics
64
65 #endif // CHROME_BROWSER_METRICS_LEAK_DETECTOR_REMOTE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698