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/observers/aborts_page_load_metrics_ob
server.h" | 5 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_ob
server.h" |
6 | 6 |
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" | 7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" |
8 | 8 |
9 using page_load_metrics::PageAbortReason; | 9 using page_load_metrics::PageAbortReason; |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return false; | 289 return false; |
290 | 290 |
291 return true; | 291 return true; |
292 } | 292 } |
293 | 293 |
294 } // namespace | 294 } // namespace |
295 | 295 |
296 AbortsPageLoadMetricsObserver::AbortsPageLoadMetricsObserver() {} | 296 AbortsPageLoadMetricsObserver::AbortsPageLoadMetricsObserver() {} |
297 | 297 |
298 void AbortsPageLoadMetricsObserver::OnComplete( | 298 void AbortsPageLoadMetricsObserver::OnComplete( |
299 const page_load_metrics::PageLoadTiming& timing, | 299 const page_load_metrics::mojom::PageLoadTiming& timing, |
300 const page_load_metrics::PageLoadExtraInfo& extra_info) { | 300 const page_load_metrics::PageLoadExtraInfo& extra_info) { |
301 page_load_metrics::PageAbortInfo abort_info = GetPageAbortInfo(extra_info); | 301 page_load_metrics::PageAbortInfo abort_info = GetPageAbortInfo(extra_info); |
302 if (!ShouldTrackMetrics(extra_info, abort_info)) | 302 if (!ShouldTrackMetrics(extra_info, abort_info)) |
303 return; | 303 return; |
304 | 304 |
305 // If we did not receive any timing IPCs from the render process, we can't | 305 // If we did not receive any timing IPCs from the render process, we can't |
306 // know for certain if the page was truly aborted before paint, or if the | 306 // know for certain if the page was truly aborted before paint, or if the |
307 // abort happened before we received the IPC from the render process. Thus, we | 307 // abort happened before we received the IPC from the render process. Thus, we |
308 // do not log aborts for these page loads. Tracked page loads that receive no | 308 // do not log aborts for these page loads. Tracked page loads that receive no |
309 // timing IPCs are tracked via the ERR_NO_IPCS_RECEIVED error code in the | 309 // timing IPCs are tracked via the ERR_NO_IPCS_RECEIVED error code in the |
310 // PageLoad.Events.InternalError histogram, so we can keep track of how often | 310 // PageLoad.Events.InternalError histogram, so we can keep track of how often |
311 // this happens. | 311 // this happens. |
312 if (timing.IsEmpty()) | 312 if (page_load_metrics::IsEmpty(timing)) |
313 return; | 313 return; |
314 | 314 |
315 if (timing.parse_timing.parse_start && | 315 if (timing.parse_timing->parse_start && |
316 abort_info.time_to_abort >= timing.parse_timing.parse_start && | 316 abort_info.time_to_abort >= timing.parse_timing->parse_start && |
317 (!timing.parse_timing.parse_stop || | 317 (!timing.parse_timing->parse_stop || |
318 timing.parse_timing.parse_stop >= abort_info.time_to_abort)) { | 318 timing.parse_timing->parse_stop >= abort_info.time_to_abort)) { |
319 RecordAbortDuringParse(abort_info); | 319 RecordAbortDuringParse(abort_info); |
320 } | 320 } |
321 if (!timing.paint_timing.first_paint || | 321 if (!timing.paint_timing->first_paint || |
322 timing.paint_timing.first_paint >= abort_info.time_to_abort) { | 322 timing.paint_timing->first_paint >= abort_info.time_to_abort) { |
323 RecordAbortAfterCommitBeforePaint(abort_info); | 323 RecordAbortAfterCommitBeforePaint(abort_info); |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 void AbortsPageLoadMetricsObserver::OnFailedProvisionalLoad( | 327 void AbortsPageLoadMetricsObserver::OnFailedProvisionalLoad( |
328 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info, | 328 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info, |
329 const page_load_metrics::PageLoadExtraInfo& extra_info) { | 329 const page_load_metrics::PageLoadExtraInfo& extra_info) { |
330 page_load_metrics::PageAbortInfo abort_info = GetPageAbortInfo(extra_info); | 330 page_load_metrics::PageAbortInfo abort_info = GetPageAbortInfo(extra_info); |
331 if (!ShouldTrackMetrics(extra_info, abort_info)) | 331 if (!ShouldTrackMetrics(extra_info, abort_info)) |
332 return; | 332 return; |
333 | 333 |
334 RecordAbortBeforeCommit(abort_info); | 334 RecordAbortBeforeCommit(abort_info); |
335 } | 335 } |
OLD | NEW |