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

Side by Side Diff: components/ukm/ukm_source.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_SOURCE_H_ 5 #ifndef COMPONENTS_UKM_UKM_SOURCE_H_
6 #define COMPONENTS_UKM_UKM_SOURCE_H_ 6 #define COMPONENTS_UKM_UKM_SOURCE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <map> 9 #include <map>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/public/browser/global_request_id.h" 13 #include "content/public/browser/global_request_id.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 namespace ukm { 16 namespace ukm {
17 17
18 class Source; 18 class Source;
19 19
20 // Contains UKM data for a single navigation entry. 20 // Contains UKM data for a single navigation entry.
21 class UkmSource { 21 class UkmSource {
22 public: 22 public:
23 UkmSource(); 23 UkmSource();
24 ~UkmSource(); 24 ~UkmSource();
25 25
26 const content::GlobalRequestID& id() const { return id_; } 26 const content::GlobalRequestID& id() const { return id_; }
27 void set_id(const content::GlobalRequestID& id) { id_ = id; } 27 void set_id(const content::GlobalRequestID& id) { id_ = id; }
28 28
29 const GURL& committed_url() const { return committed_url_; } 29 const GURL& url() const { return url_; }
30 void set_committed_url(const GURL& committed_url) { 30 void set_url(const GURL& url) { url_ = url; }
31 committed_url_ = committed_url;
32 }
33
34 base::TimeDelta first_contentful_paint() const {
35 return first_contentful_paint_;
36 }
37 void set_first_contentful_paint(base::TimeDelta first_contentful_paint) {
38 first_contentful_paint_ = first_contentful_paint;
39 }
40 31
41 // Serializes the members of the class into the supplied proto. 32 // Serializes the members of the class into the supplied proto.
42 void PopulateProto(Source* proto_source); 33 void PopulateProto(Source* proto_source) const;
43 34
44 // Get the hashed source ID, which is the hash of the child and request id 35 // Get the hashed source ID, which is the hash of the child and request id
45 // pairs from content::GlobalRequestID. 36 // pairs from content::GlobalRequestID.
46 static int32_t GetHashedSourceID(const content::GlobalRequestID& id); 37 static int32_t GetHashedSourceID(const content::GlobalRequestID& id);
47 38
48 private: 39 private:
49 content::GlobalRequestID id_; 40 content::GlobalRequestID id_;
50 GURL committed_url_; 41 GURL url_;
51 base::TimeDelta first_contentful_paint_;
52 42
53 DISALLOW_COPY_AND_ASSIGN(UkmSource); 43 DISALLOW_COPY_AND_ASSIGN(UkmSource);
54 }; 44 };
55 45
56 } // namespace ukm 46 } // namespace ukm
57 47
58 #endif // COMPONENTS_UKM_UKM_SOURCE_H_ 48 #endif // COMPONENTS_UKM_UKM_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698