| 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/browser/page_load_metrics/metrics_web_contents_observer.h" | 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 | 171 |
| 172 if (!EventsInOrder(timing.first_paint, timing.first_contentful_paint)) { | 172 if (!EventsInOrder(timing.first_paint, timing.first_contentful_paint)) { |
| 173 NOTREACHED() << "Invalid first_paint " << timing.first_paint | 173 NOTREACHED() << "Invalid first_paint " << timing.first_paint |
| 174 << " for first_contentful_paint " | 174 << " for first_contentful_paint " |
| 175 << timing.first_contentful_paint; | 175 << timing.first_contentful_paint; |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 | 178 |
| 179 if (!EventsInOrder(timing.first_paint, timing.first_meaningful_paint)) { |
| 180 NOTREACHED() << "Invalid first_paint " << timing.first_paint |
| 181 << " for first_meaningful_paint " |
| 182 << timing.first_meaningful_paint; |
| 183 return false; |
| 184 } |
| 185 |
| 179 return true; | 186 return true; |
| 180 } | 187 } |
| 181 | 188 |
| 182 void RecordInternalError(InternalErrorLoadEvent event) { | 189 void RecordInternalError(InternalErrorLoadEvent event) { |
| 183 UMA_HISTOGRAM_ENUMERATION(internal::kErrorEvents, event, ERR_LAST_ENTRY); | 190 UMA_HISTOGRAM_ENUMERATION(internal::kErrorEvents, event, ERR_LAST_ENTRY); |
| 184 } | 191 } |
| 185 | 192 |
| 186 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) { | 193 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) { |
| 187 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground, | 194 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground, |
| 188 completed_after_background); | 195 completed_after_background); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if (new_timing.first_layout && !last_timing.first_layout) | 235 if (new_timing.first_layout && !last_timing.first_layout) |
| 229 observer->OnFirstLayout(new_timing, extra_info); | 236 observer->OnFirstLayout(new_timing, extra_info); |
| 230 if (new_timing.first_paint && !last_timing.first_paint) | 237 if (new_timing.first_paint && !last_timing.first_paint) |
| 231 observer->OnFirstPaint(new_timing, extra_info); | 238 observer->OnFirstPaint(new_timing, extra_info); |
| 232 if (new_timing.first_text_paint && !last_timing.first_text_paint) | 239 if (new_timing.first_text_paint && !last_timing.first_text_paint) |
| 233 observer->OnFirstTextPaint(new_timing, extra_info); | 240 observer->OnFirstTextPaint(new_timing, extra_info); |
| 234 if (new_timing.first_image_paint && !last_timing.first_image_paint) | 241 if (new_timing.first_image_paint && !last_timing.first_image_paint) |
| 235 observer->OnFirstImagePaint(new_timing, extra_info); | 242 observer->OnFirstImagePaint(new_timing, extra_info); |
| 236 if (new_timing.first_contentful_paint && !last_timing.first_contentful_paint) | 243 if (new_timing.first_contentful_paint && !last_timing.first_contentful_paint) |
| 237 observer->OnFirstContentfulPaint(new_timing, extra_info); | 244 observer->OnFirstContentfulPaint(new_timing, extra_info); |
| 245 if (new_timing.first_meaningful_paint && !last_timing.first_meaningful_paint) |
| 246 observer->OnFirstMeaningfulPaint(new_timing, extra_info); |
| 238 if (new_timing.parse_start && !last_timing.parse_start) | 247 if (new_timing.parse_start && !last_timing.parse_start) |
| 239 observer->OnParseStart(new_timing, extra_info); | 248 observer->OnParseStart(new_timing, extra_info); |
| 240 if (new_timing.parse_stop && !last_timing.parse_stop) | 249 if (new_timing.parse_stop && !last_timing.parse_stop) |
| 241 observer->OnParseStop(new_timing, extra_info); | 250 observer->OnParseStop(new_timing, extra_info); |
| 242 if (extra_info.metadata.behavior_flags != last_metadata.behavior_flags) | 251 if (extra_info.metadata.behavior_flags != last_metadata.behavior_flags) |
| 243 observer->OnLoadingBehaviorObserved(extra_info); | 252 observer->OnLoadingBehaviorObserved(extra_info); |
| 244 } | 253 } |
| 245 | 254 |
| 246 } // namespace | 255 } // namespace |
| 247 | 256 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) | 1031 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) |
| 1023 return false; | 1032 return false; |
| 1024 const std::string& mime_type = web_contents()->GetContentsMimeType(); | 1033 const std::string& mime_type = web_contents()->GetContentsMimeType(); |
| 1025 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") | 1034 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") |
| 1026 return false; | 1035 return false; |
| 1027 } | 1036 } |
| 1028 return true; | 1037 return true; |
| 1029 } | 1038 } |
| 1030 | 1039 |
| 1031 } // namespace page_load_metrics | 1040 } // namespace page_load_metrics |
| OLD | NEW |