| OLD | NEW | 
|---|
| (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/public/ukm_entry_builder.h" | 
|  | 6 | 
|  | 7 #include <memory> | 
|  | 8 | 
|  | 9 #include "base/metrics/metrics_hashes.h" | 
|  | 10 #include "components/ukm/public/interfaces/ukm_interface.mojom.h" | 
|  | 11 | 
|  | 12 namespace ukm { | 
|  | 13 | 
|  | 14 UkmEntryBuilder::UkmEntryBuilder( | 
|  | 15     const UkmEntryBuilder::AddEntryCallback& callback, | 
|  | 16     ukm::SourceId source_id, | 
|  | 17     const char* event_name) | 
|  | 18     : add_entry_callback_(callback), entry_(mojom::UkmEntry::New()) { | 
|  | 19   entry_->source_id = source_id; | 
|  | 20   entry_->event_hash = base::HashMetricName(event_name); | 
|  | 21 } | 
|  | 22 | 
|  | 23 UkmEntryBuilder::~UkmEntryBuilder() { | 
|  | 24   add_entry_callback_.Run(std::move(entry_)); | 
|  | 25 } | 
|  | 26 | 
|  | 27 void UkmEntryBuilder::AddMetric(const char* metric_name, int64_t value) { | 
|  | 28   entry_->metrics.emplace_back( | 
|  | 29       mojom::UkmMetric::New(base::HashMetricName(metric_name), value)); | 
|  | 30 } | 
|  | 31 | 
|  | 32 }  // namespace ukm | 
| OLD | NEW | 
|---|