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

Side by Side Diff: components/ukm/ukm_entry.cc

Issue 2893943004: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Fixed contextualsearch 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/ukm_entry.h ('k') | components/ukm/ukm_entry_builder.h » ('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 #include "components/ukm/ukm_entry.h"
6
7 #include "base/metrics/metrics_hashes.h"
8 #include "components/metrics/proto/ukm/entry.pb.h"
9 #include "components/ukm/ukm_source.h"
10
11 namespace ukm {
12
13 UkmEntry::UkmEntry(int32_t source_id, const char* event_name)
14 : source_id_(source_id), event_hash_(base::HashMetricName(event_name)) {}
15
16 UkmEntry::~UkmEntry() {}
17
18 void UkmEntry::PopulateProto(Entry* proto_entry) const {
19 DCHECK(!proto_entry->has_source_id());
20 DCHECK(!proto_entry->has_event_hash());
21
22 proto_entry->set_source_id(source_id_);
23 proto_entry->set_event_hash(event_hash_);
24 for (auto& metric : metrics_) {
25 Entry::Metric* proto_metric = proto_entry->add_metrics();
26 proto_metric->set_metric_hash(std::get<0>(metric));
27 proto_metric->set_value(std::get<1>(metric));
28 }
29 }
30
31 } // namespace ukm
OLDNEW
« no previous file with comments | « components/ukm/ukm_entry.h ('k') | components/ukm/ukm_entry_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698