| OLD | NEW |
| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 bool operator==(const PageLoadTiming& other) const; | 23 bool operator==(const PageLoadTiming& other) const; |
| 24 bool operator!=(const PageLoadTiming& other) const { | 24 bool operator!=(const PageLoadTiming& other) const { |
| 25 return !(*this == other); | 25 return !(*this == other); |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool IsEmpty() const; | 28 bool IsEmpty() const; |
| 29 | 29 |
| 30 // Time that the navigation for the associated page was initiated. | 30 // Time that the navigation for the associated page was initiated. |
| 31 base::Time navigation_start; | 31 base::Time navigation_start; |
| 32 | 32 |
| 33 // All TimeDeltas are relative to navigation_start | 33 // Fields are defined in the header page_load_timing_fields.h, so we have a |
| 34 // single common definition of fields that can be reused here, in operator==, |
| 35 // and in IsEmpty. |
| 34 | 36 |
| 35 // Time that the first byte of the response is received. | 37 #define PAGE_LOAD_TIMING_TIME_DELTA_FIELD(field_name) \ |
| 36 base::Optional<base::TimeDelta> response_start; | 38 base::Optional<base::TimeDelta> field_name; |
| 37 | 39 #include "chrome/common/page_load_metrics/page_load_timing_fields.h" |
| 38 // Time immediately before the DOMContentLoaded event is fired. | 40 #undef PAGE_LOAD_TIMING_TIME_DELTA_FIELD |
| 39 base::Optional<base::TimeDelta> dom_content_loaded_event_start; | |
| 40 | |
| 41 // Time immediately before the load event is fired. | |
| 42 base::Optional<base::TimeDelta> load_event_start; | |
| 43 | |
| 44 // Time when the first layout is completed. | |
| 45 base::Optional<base::TimeDelta> first_layout; | |
| 46 | |
| 47 // Time when the first paint is performed. | |
| 48 base::Optional<base::TimeDelta> first_paint; | |
| 49 // Time when the first non-blank text is painted. | |
| 50 base::Optional<base::TimeDelta> first_text_paint; | |
| 51 // Time when the first image is painted. | |
| 52 base::Optional<base::TimeDelta> first_image_paint; | |
| 53 // Time when the first contentful thing (image, text, etc.) is painted. | |
| 54 base::Optional<base::TimeDelta> first_contentful_paint; | |
| 55 | |
| 56 // Time that the document's parser started and stopped parsing main resource | |
| 57 // content. | |
| 58 base::Optional<base::TimeDelta> parse_start; | |
| 59 base::Optional<base::TimeDelta> parse_stop; | |
| 60 | |
| 61 // Sum of times when the parser is blocked waiting on the load of a script. | |
| 62 // This duration takes place between parser_start and parser_stop, and thus | |
| 63 // must be less than or equal to parser_stop - parser_start. Note that this | |
| 64 // value may be updated multiple times during the period between parse_start | |
| 65 // and parse_stop. | |
| 66 base::Optional<base::TimeDelta> parse_blocked_on_script_load_duration; | |
| 67 | |
| 68 // Sum of times when the parser is blocked waiting on the load of a script | |
| 69 // that was inserted from document.write. This duration must be less than or | |
| 70 // equal to parse_blocked_on_script_load_duration. Note that this value may be | |
| 71 // updated multiple times during the period between parse_start and | |
| 72 // parse_stop. Note that some uncommon cases where scripts are loaded via | |
| 73 // document.write are not currently covered by this field. See crbug/600711 | |
| 74 // for details. | |
| 75 base::Optional<base::TimeDelta> | |
| 76 parse_blocked_on_script_load_from_document_write_duration; | |
| 77 | |
| 78 // If you add additional members, also be sure to update operator==, | |
| 79 // page_load_metrics_messages.h, and IsEmpty(). | |
| 80 }; | 41 }; |
| 81 | 42 |
| 82 struct PageLoadMetadata { | 43 struct PageLoadMetadata { |
| 83 PageLoadMetadata(); | 44 PageLoadMetadata(); |
| 84 bool operator==(const PageLoadMetadata& other) const; | 45 bool operator==(const PageLoadMetadata& other) const; |
| 85 // These are packed blink::WebLoadingBehaviorFlag enums. | 46 // These are packed blink::WebLoadingBehaviorFlag enums. |
| 86 int behavior_flags = blink::WebLoadingBehaviorNone; | 47 int behavior_flags = blink::WebLoadingBehaviorNone; |
| 87 }; | 48 }; |
| 88 | 49 |
| 89 } // namespace page_load_metrics | 50 } // namespace page_load_metrics |
| 90 | 51 |
| 91 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_ | 52 #endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_TIMING_H_ |
| OLD | NEW |