| 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 #include "chrome/common/page_load_metrics/page_load_timing.h" | 5 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| 6 | 6 |
| 7 namespace page_load_metrics { | 7 namespace page_load_metrics { |
| 8 | 8 |
| 9 DocumentTiming::DocumentTiming() {} |
| 10 |
| 11 DocumentTiming::DocumentTiming(const DocumentTiming& other) = default; |
| 12 |
| 13 DocumentTiming::~DocumentTiming() {} |
| 14 |
| 15 bool DocumentTiming::operator==(const DocumentTiming& other) const { |
| 16 return dom_content_loaded_event_start == |
| 17 other.dom_content_loaded_event_start && |
| 18 load_event_start == other.load_event_start && |
| 19 first_layout == other.first_layout; |
| 20 } |
| 21 |
| 22 bool DocumentTiming::IsEmpty() const { |
| 23 return !dom_content_loaded_event_start && !load_event_start && !first_layout; |
| 24 } |
| 25 |
| 26 PaintTiming::PaintTiming() {} |
| 27 |
| 28 PaintTiming::PaintTiming(const PaintTiming& other) = default; |
| 29 |
| 30 PaintTiming::~PaintTiming() {} |
| 31 |
| 32 bool PaintTiming::operator==(const PaintTiming& other) const { |
| 33 return first_paint == other.first_paint && |
| 34 first_text_paint == other.first_text_paint && |
| 35 first_image_paint == other.first_image_paint && |
| 36 first_contentful_paint == other.first_contentful_paint && |
| 37 first_meaningful_paint == other.first_meaningful_paint; |
| 38 } |
| 39 |
| 40 bool PaintTiming::IsEmpty() const { |
| 41 return !first_paint && !first_text_paint && !first_image_paint && |
| 42 !first_contentful_paint && !first_meaningful_paint; |
| 43 } |
| 44 |
| 45 ParseTiming::ParseTiming() {} |
| 46 |
| 47 ParseTiming::ParseTiming(const ParseTiming& other) = default; |
| 48 |
| 49 ParseTiming::~ParseTiming() {} |
| 50 |
| 51 bool ParseTiming::operator==(const ParseTiming& other) const { |
| 52 return parse_start == other.parse_start && parse_stop == other.parse_stop && |
| 53 parse_blocked_on_script_load_duration == |
| 54 other.parse_blocked_on_script_load_duration && |
| 55 parse_blocked_on_script_load_from_document_write_duration == |
| 56 other.parse_blocked_on_script_load_from_document_write_duration && |
| 57 parse_blocked_on_script_execution_duration == |
| 58 other.parse_blocked_on_script_execution_duration && |
| 59 parse_blocked_on_script_execution_from_document_write_duration == |
| 60 other |
| 61 .parse_blocked_on_script_execution_from_document_write_duration
; |
| 62 } |
| 63 |
| 64 bool ParseTiming::IsEmpty() const { |
| 65 return !parse_start && !parse_stop && |
| 66 !parse_blocked_on_script_load_duration && |
| 67 !parse_blocked_on_script_load_from_document_write_duration && |
| 68 !parse_blocked_on_script_execution_duration && |
| 69 !parse_blocked_on_script_execution_from_document_write_duration; |
| 70 } |
| 71 |
| 9 StyleSheetTiming::StyleSheetTiming() {} | 72 StyleSheetTiming::StyleSheetTiming() {} |
| 10 | 73 |
| 11 StyleSheetTiming::StyleSheetTiming(const StyleSheetTiming& other) = default; | 74 StyleSheetTiming::StyleSheetTiming(const StyleSheetTiming& other) = default; |
| 12 | 75 |
| 13 StyleSheetTiming::~StyleSheetTiming() {} | 76 StyleSheetTiming::~StyleSheetTiming() {} |
| 14 | 77 |
| 15 bool StyleSheetTiming::operator==(const StyleSheetTiming& other) const { | 78 bool StyleSheetTiming::operator==(const StyleSheetTiming& other) const { |
| 16 return author_style_sheet_parse_duration_before_fcp == | 79 return author_style_sheet_parse_duration_before_fcp == |
| 17 other.author_style_sheet_parse_duration_before_fcp && | 80 other.author_style_sheet_parse_duration_before_fcp && |
| 18 update_style_duration_before_fcp == | 81 update_style_duration_before_fcp == |
| 19 other.update_style_duration_before_fcp; | 82 other.update_style_duration_before_fcp; |
| 20 } | 83 } |
| 21 | 84 |
| 22 bool StyleSheetTiming::IsEmpty() const { | 85 bool StyleSheetTiming::IsEmpty() const { |
| 23 return !author_style_sheet_parse_duration_before_fcp && | 86 return !author_style_sheet_parse_duration_before_fcp && |
| 24 !update_style_duration_before_fcp; | 87 !update_style_duration_before_fcp; |
| 25 } | 88 } |
| 26 | 89 |
| 27 PageLoadTiming::PageLoadTiming() {} | 90 PageLoadTiming::PageLoadTiming() {} |
| 28 | 91 |
| 29 PageLoadTiming::PageLoadTiming(const PageLoadTiming& other) = default; | 92 PageLoadTiming::PageLoadTiming(const PageLoadTiming& other) = default; |
| 30 | 93 |
| 31 PageLoadTiming::~PageLoadTiming() {} | 94 PageLoadTiming::~PageLoadTiming() {} |
| 32 | 95 |
| 33 bool PageLoadTiming::operator==(const PageLoadTiming& other) const { | 96 bool PageLoadTiming::operator==(const PageLoadTiming& other) const { |
| 34 return navigation_start == other.navigation_start && | 97 return navigation_start == other.navigation_start && |
| 35 response_start == other.response_start && | 98 response_start == other.response_start && |
| 36 dom_content_loaded_event_start == | 99 document_timing == other.document_timing && |
| 37 other.dom_content_loaded_event_start && | 100 paint_timing == other.paint_timing && |
| 38 load_event_start == other.load_event_start && | 101 parse_timing == other.parse_timing && |
| 39 first_layout == other.first_layout && | |
| 40 first_paint == other.first_paint && | |
| 41 first_text_paint == other.first_text_paint && | |
| 42 first_image_paint == other.first_image_paint && | |
| 43 first_contentful_paint == other.first_contentful_paint && | |
| 44 first_meaningful_paint == other.first_meaningful_paint && | |
| 45 parse_start == other.parse_start && parse_stop == other.parse_stop && | |
| 46 parse_blocked_on_script_load_duration == | |
| 47 other.parse_blocked_on_script_load_duration && | |
| 48 parse_blocked_on_script_load_from_document_write_duration == | |
| 49 other.parse_blocked_on_script_load_from_document_write_duration && | |
| 50 parse_blocked_on_script_execution_duration == | |
| 51 other.parse_blocked_on_script_execution_duration && | |
| 52 parse_blocked_on_script_execution_from_document_write_duration == | |
| 53 other | |
| 54 .parse_blocked_on_script_execution_from_document_write_duration
&& | |
| 55 style_sheet_timing == other.style_sheet_timing; | 102 style_sheet_timing == other.style_sheet_timing; |
| 56 } | 103 } |
| 57 | 104 |
| 58 bool PageLoadTiming::IsEmpty() const { | 105 bool PageLoadTiming::IsEmpty() const { |
| 59 return navigation_start.is_null() && !response_start && | 106 return navigation_start.is_null() && !response_start && |
| 60 !dom_content_loaded_event_start && !load_event_start && | 107 document_timing.IsEmpty() && paint_timing.IsEmpty() && |
| 61 !first_layout && !first_paint && !first_text_paint && | 108 parse_timing.IsEmpty() && style_sheet_timing.IsEmpty(); |
| 62 !first_image_paint && !first_contentful_paint && | |
| 63 !first_meaningful_paint && !parse_start && !parse_stop && | |
| 64 !parse_blocked_on_script_load_duration && | |
| 65 !parse_blocked_on_script_load_from_document_write_duration && | |
| 66 !parse_blocked_on_script_execution_duration && | |
| 67 !parse_blocked_on_script_execution_from_document_write_duration && | |
| 68 style_sheet_timing.IsEmpty(); | |
| 69 } | 109 } |
| 70 | 110 |
| 71 PageLoadMetadata::PageLoadMetadata() {} | 111 PageLoadMetadata::PageLoadMetadata() {} |
| 72 | 112 |
| 73 bool PageLoadMetadata::operator==(const PageLoadMetadata& other) const { | 113 bool PageLoadMetadata::operator==(const PageLoadMetadata& other) const { |
| 74 return behavior_flags == other.behavior_flags; | 114 return behavior_flags == other.behavior_flags; |
| 75 } | 115 } |
| 76 | 116 |
| 77 } // namespace page_load_metrics | 117 } // namespace page_load_metrics |
| OLD | NEW |