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

Side by Side Diff: components/ukm/public/mojo_ukm_recorder.h

Issue 2882353002: Implement Ukm Mojo interface. (Closed)
Patch Set: Fix nits Created 3 years, 7 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
« no previous file with comments | « components/ukm/public/BUILD.gn ('k') | components/ukm/public/mojo_ukm_recorder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
6 #define COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
7
8 #include "components/ukm/public/interfaces/ukm_interface.mojom.h"
9 #include "components/ukm/public/ukm_recorder.h"
10
11 namespace ukm {
12
13 /**
14 * A helper wrapper that lets UKM data be recorded on other processes with the
15 * same interface that is used in the browser process.
16 *
17 * Usage Example:
18 *
19 * ukm::mojom::UkmRecorderInterfacePtr interface;
20 * content::RenderThread::Get()->GetConnector()->BindInterface(
21 * content::mojom::kBrowserServiceName, mojo::MakeRequest(&interface));
22 * ukm::MojoUkmRecorder recorder(std::move(interface));
23 * std::unique_ptr<ukm::UkmEntryBuilder> builder =
24 * recorder.GetEntryBuilder(coordination_unit_id, "MyEvent");
25 * builder->AddMetric("MyMetric", metric_value);
26 */
27 class MojoUkmRecorder : public UkmRecorder {
28 public:
29 MojoUkmRecorder(mojom::UkmRecorderInterfacePtr interface);
30 ~MojoUkmRecorder() override;
31
32 private:
33 // UkmRecorder:
34 void UpdateSourceURL(SourceId source_id, const GURL& url) override;
35 void AddEntry(mojom::UkmEntryPtr entry) override;
36
37 mojom::UkmRecorderInterfacePtr interface_;
38
39 DISALLOW_COPY_AND_ASSIGN(MojoUkmRecorder);
40 };
41
42 } // namespace ukm
43
44 #endif // COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
OLDNEW
« no previous file with comments | « components/ukm/public/BUILD.gn ('k') | components/ukm/public/mojo_ukm_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698