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 #ifndef COMPONENTS_UKM_UKM_ENTRY_H_ | |
6 #define COMPONENTS_UKM_UKM_ENTRY_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 | |
13 namespace ukm { | |
14 | |
15 class Entry; | |
16 class UkmEntryBuilder; | |
17 | |
18 // One UkmEntry contains metrics for a specific source and event. It is | |
19 // connected to a UkmSource by the source ID. The event can be user defined. | |
20 // One example is "PageLoad". Each UkmEntry can have a list of metrics, each of | |
21 // which consist of a metric name and value. When the entry is serialized to the | |
22 // proto message, the event and metric names will be hashed by | |
23 // base::HashMetricName. | |
24 // | |
25 // To build UkmEntry objects, please use UkmEntryBuilder. | |
26 class UkmEntry { | |
27 public: | |
28 // Serializes the members of the class into the supplied proto. | |
29 void PopulateProto(Entry* proto_entry) const; | |
30 | |
31 int32_t source_id() const { return source_id_; } | |
32 uint64_t event_hash() const { return event_hash_; } | |
33 | |
34 ~UkmEntry(); | |
35 | |
36 private: | |
37 friend UkmEntryBuilder; | |
38 | |
39 UkmEntry(int32_t source_id, const char* event_name); | |
40 | |
41 const int32_t source_id_; | |
42 const uint64_t event_hash_; | |
43 std::vector<std::pair<uint64_t, int64_t>> metrics_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(UkmEntry); | |
46 }; | |
47 | |
48 } // namespace ukm | |
49 | |
50 #endif // COMPONENTS_UKM_UKM_ENTRY_H_ | |
OLD | NEW |