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

Side by Side Diff: chrome/common/page_load_metrics/page_load_timing.h

Issue 2806863003: [Page Load Metrics] Structure PageLoadTiming. (Closed)
Patch Set: rebase Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_ 5 #ifndef CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_
6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_ 6 #define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_
7 7
8 #include "base/optional.h" 8 #include "base/optional.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" 10 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
11 11
12 namespace page_load_metrics { 12 namespace page_load_metrics {
13 13
14 struct StyleSheetTiming { 14 struct DocumentTiming {
15 StyleSheetTiming(); 15 DocumentTiming();
16 StyleSheetTiming(const StyleSheetTiming& other); 16 DocumentTiming(const DocumentTiming& other);
17 ~StyleSheetTiming(); 17 ~DocumentTiming();
18 18
19 bool operator==(const StyleSheetTiming& other) const; 19 bool operator==(const DocumentTiming& other) const;
20 bool operator!=(const StyleSheetTiming& other) const { 20 bool operator!=(const DocumentTiming& other) const {
21 return !(*this == other); 21 return !(*this == other);
22 } 22 }
23 23
24 bool IsEmpty() const; 24 bool IsEmpty() const;
25 25
26 // Total time spent parsing author style sheets, before the first contentful 26 // TimeDeltas below relative to navigation start:
27 // paint.
28 base::Optional<base::TimeDelta> author_style_sheet_parse_duration_before_fcp;
29 27
30 // Time spent in Document::updateStyle before FCP. 28 // Time immediately before the DOMContentLoaded event is fired.
31 base::Optional<base::TimeDelta> update_style_duration_before_fcp; 29 base::Optional<base::TimeDelta> dom_content_loaded_event_start;
30 // Time immediately before the load event is fired.
31 base::Optional<base::TimeDelta> load_event_start;
32 // Time when the first layout is completed.
33 base::Optional<base::TimeDelta> first_layout;
32 }; 34 };
33 35
34 // PageLoadTiming contains timing metrics associated with a page load. Many of 36 struct PaintTiming {
35 // the metrics here are based on the Navigation Timing spec: 37 PaintTiming();
36 // http://www.w3.org/TR/navigation-timing/. 38 PaintTiming(const PaintTiming& other);
37 struct PageLoadTiming { 39 ~PaintTiming();
38 public:
39 PageLoadTiming();
40 PageLoadTiming(const PageLoadTiming& other);
41 ~PageLoadTiming();
42 40
43 bool operator==(const PageLoadTiming& other) const; 41 bool operator==(const PaintTiming& other) const;
44 bool operator!=(const PageLoadTiming& other) const { 42 bool operator!=(const PaintTiming& other) const { return !(*this == other); }
45 return !(*this == other);
46 }
47 43
48 bool IsEmpty() const; 44 bool IsEmpty() const;
49 45
50 // Time that the navigation for the associated page was initiated. Note that 46 // TimeDeltas below relative to navigation start:
51 // this field is only used for internal tracking purposes and should not be
52 // used by PageLoadMetricsObservers. This field will likely be removed in the
53 // future.
54 base::Time navigation_start;
55
56 // TimeDeltas relative to navigation_start:
57
58 // Time that the first byte of the response is received.
59 base::Optional<base::TimeDelta> response_start;
60
61 // Time immediately before the DOMContentLoaded event is fired.
62 base::Optional<base::TimeDelta> dom_content_loaded_event_start;
63
64 // Time immediately before the load event is fired.
65 base::Optional<base::TimeDelta> load_event_start;
66
67 // Time when the first layout is completed.
68 base::Optional<base::TimeDelta> first_layout;
69 47
70 // Time when the first paint is performed. 48 // Time when the first paint is performed.
71 base::Optional<base::TimeDelta> first_paint; 49 base::Optional<base::TimeDelta> first_paint;
72 // Time when the first non-blank text is painted. 50 // Time when the first non-blank text is painted.
73 base::Optional<base::TimeDelta> first_text_paint; 51 base::Optional<base::TimeDelta> first_text_paint;
74 // Time when the first image is painted. 52 // Time when the first image is painted.
75 base::Optional<base::TimeDelta> first_image_paint; 53 base::Optional<base::TimeDelta> first_image_paint;
76 // Time when the first contentful thing (image, text, etc.) is painted. 54 // Time when the first contentful thing (image, text, etc.) is painted.
77 base::Optional<base::TimeDelta> first_contentful_paint; 55 base::Optional<base::TimeDelta> first_contentful_paint;
78 // (Experimental) Time when the page's primary content is painted. 56 // (Experimental) Time when the page's primary content is painted.
79 base::Optional<base::TimeDelta> first_meaningful_paint; 57 base::Optional<base::TimeDelta> first_meaningful_paint;
58 };
80 59
60 struct ParseTiming {
61 ParseTiming();
62 ParseTiming(const ParseTiming& other);
63 ~ParseTiming();
64
65 bool operator==(const ParseTiming& other) const;
66 bool operator!=(const ParseTiming& other) const { return !(*this == other); }
67
68 bool IsEmpty() const;
81 69
82 // TimeDeltas below represent durations of time during the page load: 70 // TimeDeltas below represent durations of time during the page load:
83 71
84 // Time that the document's parser started and stopped parsing main resource 72 // Time that the document's parser started and stopped parsing main resource
85 // content. 73 // content.
86 base::Optional<base::TimeDelta> parse_start; 74 base::Optional<base::TimeDelta> parse_start;
87 base::Optional<base::TimeDelta> parse_stop; 75 base::Optional<base::TimeDelta> parse_stop;
88 76
89 // Sum of times when the parser is blocked waiting on the load of a script. 77 // Sum of times when the parser is blocked waiting on the load of a script.
90 // This duration takes place between parser_start and parser_stop, and thus 78 // This duration takes place between parser_start and parser_stop, and thus
(...skipping 19 matching lines...) Expand all
110 base::Optional<base::TimeDelta> parse_blocked_on_script_execution_duration; 98 base::Optional<base::TimeDelta> parse_blocked_on_script_execution_duration;
111 99
112 // Sum of times when the parser is executing a script that was inserted from 100 // Sum of times when the parser is executing a script that was inserted from
113 // document.write. This duration must be less than or equal to 101 // document.write. This duration must be less than or equal to
114 // parse_blocked_on_script_load_duration. Note that this value may be updated 102 // parse_blocked_on_script_load_duration. Note that this value may be updated
115 // multiple times during the period between parse_start and parse_stop. Note 103 // multiple times during the period between parse_start and parse_stop. Note
116 // that some uncommon cases where scripts are loaded via document.write are 104 // that some uncommon cases where scripts are loaded via document.write are
117 // not currently covered by this field. See crbug/600711 for details. 105 // not currently covered by this field. See crbug/600711 for details.
118 base::Optional<base::TimeDelta> 106 base::Optional<base::TimeDelta>
119 parse_blocked_on_script_execution_from_document_write_duration; 107 parse_blocked_on_script_execution_from_document_write_duration;
108 };
120 109
110 struct StyleSheetTiming {
111 StyleSheetTiming();
112 StyleSheetTiming(const StyleSheetTiming& other);
113 ~StyleSheetTiming();
114
115 bool operator==(const StyleSheetTiming& other) const;
116 bool operator!=(const StyleSheetTiming& other) const {
117 return !(*this == other);
118 }
119
120 bool IsEmpty() const;
121
122 // Total time spent parsing author style sheets, before the first contentful
123 // paint.
124 base::Optional<base::TimeDelta> author_style_sheet_parse_duration_before_fcp;
125
126 // Time spent in Document::updateStyle before FCP.
127 base::Optional<base::TimeDelta> update_style_duration_before_fcp;
128 };
129
130 // PageLoadTiming contains timing metrics associated with a page load. Many of
131 // the metrics here are based on the Navigation Timing spec:
132 // http://www.w3.org/TR/navigation-timing/.
133 struct PageLoadTiming {
134 public:
135 PageLoadTiming();
136 PageLoadTiming(const PageLoadTiming& other);
137 ~PageLoadTiming();
138
139 bool operator==(const PageLoadTiming& other) const;
140 bool operator!=(const PageLoadTiming& other) const {
141 return !(*this == other);
142 }
143
144 bool IsEmpty() const;
145
146 // Time that the navigation for the associated page was initiated. Note that
147 // this field is only used for internal tracking purposes and should not be
148 // used by PageLoadMetricsObservers. This field will likely be removed in the
149 // future.
150 base::Time navigation_start;
151
152 // Time relative to navigation_start that the first byte of the response is
153 // received.
154 base::Optional<base::TimeDelta> response_start;
155
156 DocumentTiming document_timing;
157 PaintTiming paint_timing;
158 ParseTiming parse_timing;
121 StyleSheetTiming style_sheet_timing; 159 StyleSheetTiming style_sheet_timing;
122 160
123 // If you add additional members, also be sure to update operator==, 161 // If you add additional members, also be sure to update operator==,
124 // page_load_metrics_messages.h, and IsEmpty(). 162 // page_load_metrics_messages.h, and IsEmpty().
125 }; 163 };
126 164
127 struct PageLoadMetadata { 165 struct PageLoadMetadata {
128 PageLoadMetadata(); 166 PageLoadMetadata();
129 bool operator==(const PageLoadMetadata& other) const; 167 bool operator==(const PageLoadMetadata& other) const;
130 // These are packed blink::WebLoadingBehaviorFlag enums. 168 // These are packed blink::WebLoadingBehaviorFlag enums.
131 int behavior_flags = blink::kWebLoadingBehaviorNone; 169 int behavior_flags = blink::kWebLoadingBehaviorNone;
132 }; 170 };
133 171
134 } // namespace page_load_metrics 172 } // namespace page_load_metrics
135 173
136 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_ 174 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_
OLDNEW
« no previous file with comments | « chrome/common/page_load_metrics/page_load_metrics_messages.h ('k') | chrome/common/page_load_metrics/page_load_timing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698