| 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 EndReasonForPageTransition(new_navigation->GetPageTransition()), | 565 EndReasonForPageTransition(new_navigation->GetPageTransition()), |
| 566 user_initiated_info, timestamp, false); | 566 user_initiated_info, timestamp, false); |
| 567 } | 567 } |
| 568 | 568 |
| 569 aborted_provisional_loads_.clear(); | 569 aborted_provisional_loads_.clear(); |
| 570 return last_aborted_load; | 570 return last_aborted_load; |
| 571 } | 571 } |
| 572 | 572 |
| 573 void MetricsWebContentsObserver::OnTimingUpdated( | 573 void MetricsWebContentsObserver::OnTimingUpdated( |
| 574 content::RenderFrameHost* render_frame_host, | 574 content::RenderFrameHost* render_frame_host, |
| 575 const PageLoadTiming& timing, | 575 const mojom::PageLoadTiming& timing, |
| 576 const PageLoadMetadata& metadata) { | 576 const mojom::PageLoadMetadata& metadata) { |
| 577 // We may receive notifications from frames that have been navigated away | 577 // We may receive notifications from frames that have been navigated away |
| 578 // from. We simply ignore them. | 578 // from. We simply ignore them. |
| 579 if (GetMainFrame(render_frame_host) != web_contents()->GetMainFrame()) { | 579 if (GetMainFrame(render_frame_host) != web_contents()->GetMainFrame()) { |
| 580 RecordInternalError(ERR_IPC_FROM_WRONG_FRAME); | 580 RecordInternalError(ERR_IPC_FROM_WRONG_FRAME); |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 | 583 |
| 584 // While timings arriving for the wrong frame are expected, we do not expect | 584 // While timings arriving for the wrong frame are expected, we do not expect |
| 585 // any of the errors below. Thus, we track occurrences of all errors below, | 585 // any of the errors below. Thus, we track occurrences of all errors below, |
| 586 // rather than returning early after encountering an error. | 586 // rather than returning early after encountering an error. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 observer_->RemoveTestingObserver(this); | 642 observer_->RemoveTestingObserver(this); |
| 643 observer_ = nullptr; | 643 observer_ = nullptr; |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { | 647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { |
| 648 observer_ = nullptr; | 648 observer_ = nullptr; |
| 649 } | 649 } |
| 650 | 650 |
| 651 } // namespace page_load_metrics | 651 } // namespace page_load_metrics |
| OLD | NEW |