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

Side by Side Diff: chrome/common/page_load_metrics/page_load_metrics.mojom

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

Powered by Google App Engine
This is Rietveld 408576698