| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return false; | 177 return false; |
| 178 } | 178 } |
| 179 | 179 |
| 180 if (!EventsInOrder(timing.first_paint, timing.first_contentful_paint)) { | 180 if (!EventsInOrder(timing.first_paint, timing.first_contentful_paint)) { |
| 181 NOTREACHED() << "Invalid first_paint " << timing.first_paint | 181 NOTREACHED() << "Invalid first_paint " << timing.first_paint |
| 182 << " for first_contentful_paint " | 182 << " for first_contentful_paint " |
| 183 << timing.first_contentful_paint; | 183 << timing.first_contentful_paint; |
| 184 return false; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 if (!EventsInOrder(timing.first_paint, timing.first_meaningful_paint)) { |
| 188 NOTREACHED() << "Invalid first_paint " << timing.first_paint |
| 189 << " for first_meaningful_paint " |
| 190 << timing.first_meaningful_paint; |
| 191 return false; |
| 192 } |
| 193 |
| 187 return true; | 194 return true; |
| 188 } | 195 } |
| 189 | 196 |
| 190 void RecordInternalError(InternalErrorLoadEvent event) { | 197 void RecordInternalError(InternalErrorLoadEvent event) { |
| 191 UMA_HISTOGRAM_ENUMERATION(internal::kErrorEvents, event, ERR_LAST_ENTRY); | 198 UMA_HISTOGRAM_ENUMERATION(internal::kErrorEvents, event, ERR_LAST_ENTRY); |
| 192 } | 199 } |
| 193 | 200 |
| 194 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) { | 201 void RecordAppBackgroundPageLoadCompleted(bool completed_after_background) { |
| 195 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground, | 202 UMA_HISTOGRAM_BOOLEAN(internal::kPageLoadCompletedAfterAppBackground, |
| 196 completed_after_background); | 203 completed_after_background); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (new_timing.first_layout && !last_timing.first_layout) | 238 if (new_timing.first_layout && !last_timing.first_layout) |
| 232 observer->OnFirstLayout(new_timing, extra_info); | 239 observer->OnFirstLayout(new_timing, extra_info); |
| 233 if (new_timing.first_paint && !last_timing.first_paint) | 240 if (new_timing.first_paint && !last_timing.first_paint) |
| 234 observer->OnFirstPaint(new_timing, extra_info); | 241 observer->OnFirstPaint(new_timing, extra_info); |
| 235 if (new_timing.first_text_paint && !last_timing.first_text_paint) | 242 if (new_timing.first_text_paint && !last_timing.first_text_paint) |
| 236 observer->OnFirstTextPaint(new_timing, extra_info); | 243 observer->OnFirstTextPaint(new_timing, extra_info); |
| 237 if (new_timing.first_image_paint && !last_timing.first_image_paint) | 244 if (new_timing.first_image_paint && !last_timing.first_image_paint) |
| 238 observer->OnFirstImagePaint(new_timing, extra_info); | 245 observer->OnFirstImagePaint(new_timing, extra_info); |
| 239 if (new_timing.first_contentful_paint && !last_timing.first_contentful_paint) | 246 if (new_timing.first_contentful_paint && !last_timing.first_contentful_paint) |
| 240 observer->OnFirstContentfulPaint(new_timing, extra_info); | 247 observer->OnFirstContentfulPaint(new_timing, extra_info); |
| 248 if (new_timing.first_meaningful_paint && !last_timing.first_meaningful_paint) |
| 249 observer->OnFirstMeaningfulPaint(new_timing, extra_info); |
| 241 if (new_timing.parse_start && !last_timing.parse_start) | 250 if (new_timing.parse_start && !last_timing.parse_start) |
| 242 observer->OnParseStart(new_timing, extra_info); | 251 observer->OnParseStart(new_timing, extra_info); |
| 243 if (new_timing.parse_stop && !last_timing.parse_stop) | 252 if (new_timing.parse_stop && !last_timing.parse_stop) |
| 244 observer->OnParseStop(new_timing, extra_info); | 253 observer->OnParseStop(new_timing, extra_info); |
| 245 if (extra_info.metadata.behavior_flags != last_metadata.behavior_flags) | 254 if (extra_info.metadata.behavior_flags != last_metadata.behavior_flags) |
| 246 observer->OnLoadingBehaviorObserved(extra_info); | 255 observer->OnLoadingBehaviorObserved(extra_info); |
| 247 } | 256 } |
| 248 | 257 |
| 249 } // namespace | 258 } // namespace |
| 250 | 259 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) | 993 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) |
| 985 return false; | 994 return false; |
| 986 const std::string& mime_type = web_contents()->GetContentsMimeType(); | 995 const std::string& mime_type = web_contents()->GetContentsMimeType(); |
| 987 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") | 996 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") |
| 988 return false; | 997 return false; |
| 989 } | 998 } |
| 990 return true; | 999 return true; |
| 991 } | 1000 } |
| 992 | 1001 |
| 993 } // namespace page_load_metrics | 1002 } // namespace page_load_metrics |
| OLD | NEW |