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

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

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

Powered by Google App Engine
This is Rietveld 408576698