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

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

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Address reviewer feedback Created 3 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_ 5 #ifndef COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
6 #define COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_ 6 #define COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
7 7
8 #include "components/ukm/public/interfaces/ukm_interface.mojom.h" 8 #include "components/ukm/public/interfaces/ukm_interface.mojom.h"
9 #include "components/ukm/public/ukm_export.h"
9 #include "components/ukm/public/ukm_recorder.h" 10 #include "components/ukm/public/ukm_recorder.h"
10 11
11 namespace ukm { 12 namespace ukm {
12 13
13 /** 14 /**
14 * A helper wrapper that lets UKM data be recorded on other processes with the 15 * 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 * same interface that is used in the browser process.
16 * 17 *
17 * Usage Example: 18 * Usage Example:
18 * 19 *
19 * ukm::mojom::UkmRecorderInterfacePtr interface; 20 * ukm::mojom::UkmRecorderInterfacePtr interface;
20 * content::RenderThread::Get()->GetConnector()->BindInterface( 21 * content::RenderThread::Get()->GetConnector()->BindInterface(
21 * content::mojom::kBrowserServiceName, mojo::MakeRequest(&interface)); 22 * content::mojom::kBrowserServiceName, mojo::MakeRequest(&interface));
22 * ukm::MojoUkmRecorder recorder(std::move(interface)); 23 * ukm::MojoUkmRecorder recorder(std::move(interface));
23 * std::unique_ptr<ukm::UkmEntryBuilder> builder = 24 * std::unique_ptr<ukm::UkmEntryBuilder> builder =
24 * recorder.GetEntryBuilder(coordination_unit_id, "MyEvent"); 25 * recorder.GetEntryBuilder(coordination_unit_id, "MyEvent");
25 * builder->AddMetric("MyMetric", metric_value); 26 * builder->AddMetric("MyMetric", metric_value);
26 */ 27 */
27 class MojoUkmRecorder : public UkmRecorder { 28 class UKM_EXPORT MojoUkmRecorder : public UkmRecorder {
28 public: 29 public:
29 MojoUkmRecorder(mojom::UkmRecorderInterfacePtr interface); 30 explicit MojoUkmRecorder(mojom::UkmRecorderInterfacePtr interface);
30 ~MojoUkmRecorder() override; 31 ~MojoUkmRecorder() override;
31 32
32 private: 33 private:
33 // UkmRecorder: 34 // UkmRecorder:
34 void UpdateSourceURL(SourceId source_id, const GURL& url) override; 35 void UpdateSourceURL(SourceId source_id, const GURL& url) override;
35 void AddEntry(mojom::UkmEntryPtr entry) override; 36 void AddEntry(mojom::UkmEntryPtr entry) override;
36 37
37 mojom::UkmRecorderInterfacePtr interface_; 38 mojom::UkmRecorderInterfacePtr interface_;
38 39
39 DISALLOW_COPY_AND_ASSIGN(MojoUkmRecorder); 40 DISALLOW_COPY_AND_ASSIGN(MojoUkmRecorder);
40 }; 41 };
41 42
42 } // namespace ukm 43 } // namespace ukm
43 44
44 #endif // COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_ 45 #endif // COMPONENTS_UKM_PUBLIC_MOJO_UKM_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698