| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_ | |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_ | |
| 7 | |
| 8 #include "base/optional.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" | |
| 11 | |
| 12 namespace page_load_metrics { | |
| 13 | |
| 14 // PageLoadTiming contains timing metrics associated with a page load. Many of | |
| 15 // the metrics here are based on the Navigation Timing spec: | |
| 16 // http://www.w3.org/TR/navigation-timing/. | |
| 17 struct PageLoadTiming { | |
| 18 public: | |
| 19 PageLoadTiming(); | |
| 20 PageLoadTiming(const PageLoadTiming& other); | |
| 21 ~PageLoadTiming(); | |
| 22 | |
| 23 bool operator==(const PageLoadTiming& other) const; | |
| 24 bool operator!=(const PageLoadTiming& other) const { | |
| 25 return !(*this == other); | |
| 26 } | |
| 27 | |
| 28 bool IsEmpty() const; | |
| 29 | |
| 30 // Time that the navigation for the associated page was initiated. | |
| 31 base::Time navigation_start; | |
| 32 | |
| 33 // All TimeDeltas are relative to navigation_start | |
| 34 | |
| 35 // Time that the first byte of the response is received. | |
| 36 base::Optional<base::TimeDelta> response_start; | |
| 37 | |
| 38 // Time that the document transitions to the 'loading' state. This is roughly | |
| 39 // the time that the HTML parser begins parsing the main HTML resource. | |
| 40 base::Optional<base::TimeDelta> dom_loading; | |
| 41 | |
| 42 // Time immediately before the DOMContentLoaded event is fired. | |
| 43 base::Optional<base::TimeDelta> dom_content_loaded_event_start; | |
| 44 | |
| 45 // Time immediately before the load event is fired. | |
| 46 base::Optional<base::TimeDelta> load_event_start; | |
| 47 | |
| 48 // Time when the first layout is completed. | |
| 49 base::Optional<base::TimeDelta> first_layout; | |
| 50 | |
| 51 // Time when the first paint is performed. | |
| 52 base::Optional<base::TimeDelta> first_paint; | |
| 53 // Time when the first non-blank text is painted. | |
| 54 base::Optional<base::TimeDelta> first_text_paint; | |
| 55 // Time when the first image is painted. | |
| 56 base::Optional<base::TimeDelta> first_image_paint; | |
| 57 // Time when the first contentful thing (image, text, etc.) is painted. | |
| 58 base::Optional<base::TimeDelta> first_contentful_paint; | |
| 59 | |
| 60 // Time that the document's parser started and stopped parsing main resource | |
| 61 // content. | |
| 62 base::Optional<base::TimeDelta> parse_start; | |
| 63 base::Optional<base::TimeDelta> parse_stop; | |
| 64 | |
| 65 // Sum of times when the parser is blocked waiting on the load of a script. | |
| 66 // This duration takes place between parser_start and parser_stop, and thus | |
| 67 // must be less than or equal to parser_stop - parser_start. Note that this | |
| 68 // value may be updated multiple times during the period between parse_start | |
| 69 // and parse_stop. | |
| 70 base::Optional<base::TimeDelta> parse_blocked_on_script_load_duration; | |
| 71 | |
| 72 // Sum of times when the parser is blocked waiting on the load of a script | |
| 73 // that was inserted from document.write. This duration must be less than or | |
| 74 // equal to parse_blocked_on_script_load_duration. Note that this value may be | |
| 75 // updated multiple times during the period between parse_start and | |
| 76 // parse_stop. Note that some uncommon cases where scripts are loaded via | |
| 77 // document.write are not currently covered by this field. See crbug/600711 | |
| 78 // for details. | |
| 79 base::Optional<base::TimeDelta> | |
| 80 parse_blocked_on_script_load_from_document_write_duration; | |
| 81 | |
| 82 // If you add additional members, also be sure to update operator==, | |
| 83 // page_load_metrics_messages.h, and IsEmpty(). | |
| 84 }; | |
| 85 | |
| 86 struct PageLoadMetadata { | |
| 87 PageLoadMetadata(); | |
| 88 bool operator==(const PageLoadMetadata& other) const; | |
| 89 // These are packed blink::WebLoadingBehaviorFlag enums. | |
| 90 int behavior_flags = blink::WebLoadingBehaviorNone; | |
| 91 }; | |
| 92 | |
| 93 } // namespace page_load_metrics | |
| 94 | |
| 95 #endif // COMPONENTS_PAGE_LOAD_METRICS_COMMON_PAGE_LOAD_TIMING_H_ | |
| OLD | NEW |