| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/page_load_tracker.h" | 5 #include "chrome/browser/page_load_metrics/page_load_tracker.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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 DCHECK_NE(started_in_foreground_, background_time_.is_null()); | 515 DCHECK_NE(started_in_foreground_, background_time_.is_null()); |
| 516 foreground_time_ = base::TimeTicks::Now(); | 516 foreground_time_ = base::TimeTicks::Now(); |
| 517 ClampBrowserTimestampIfInterProcessTimeTickSkew(&foreground_time_); | 517 ClampBrowserTimestampIfInterProcessTimeTickSkew(&foreground_time_); |
| 518 } | 518 } |
| 519 | 519 |
| 520 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnShown); | 520 INVOKE_AND_PRUNE_OBSERVERS(observers_, OnShown); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void PageLoadTracker::WillProcessNavigationResponse( | 523 void PageLoadTracker::WillProcessNavigationResponse( |
| 524 content::NavigationHandle* navigation_handle) { | 524 content::NavigationHandle* navigation_handle) { |
| 525 // PlzNavigate: NavigationHandle::GetGlobalRequestID() sometimes returns an | |
| 526 // uninitialized GlobalRequestID. Bail early in this case. See | |
| 527 // crbug.com/680841 for details. | |
| 528 // TODO(jkarlin): NavigationSimulator is the first unittest framework to hit | |
| 529 // this function, and it doesn't provide a GlobalRequestID. Add an ID. See | |
| 530 // crbug.com/711352 for details. | |
| 531 if (navigation_handle->GetGlobalRequestID() == content::GlobalRequestID()) | |
| 532 return; | |
| 533 | |
| 534 DCHECK(!navigation_request_id_.has_value()); | 525 DCHECK(!navigation_request_id_.has_value()); |
| 535 navigation_request_id_ = navigation_handle->GetGlobalRequestID(); | 526 navigation_request_id_ = navigation_handle->GetGlobalRequestID(); |
| 536 DCHECK(navigation_request_id_.value() != content::GlobalRequestID()); | 527 DCHECK(navigation_request_id_.value() != content::GlobalRequestID()); |
| 537 } | 528 } |
| 538 | 529 |
| 539 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) { | 530 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) { |
| 540 did_commit_ = true; | 531 did_commit_ = true; |
| 541 url_ = navigation_handle->GetURL(); | 532 url_ = navigation_handle->GetURL(); |
| 542 // Some transitions (like CLIENT_REDIRECT) are only known at commit time. | 533 // Some transitions (like CLIENT_REDIRECT) are only known at commit time. |
| 543 page_transition_ = navigation_handle->GetPageTransition(); | 534 page_transition_ = navigation_handle->GetPageTransition(); |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 observer->MediaStartedPlaying(video_type, is_in_main_frame); | 927 observer->MediaStartedPlaying(video_type, is_in_main_frame); |
| 937 } | 928 } |
| 938 | 929 |
| 939 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay, | 930 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay, |
| 940 base::TimeDelta actual_delay) { | 931 base::TimeDelta actual_delay) { |
| 941 for (const auto& observer : observers_) | 932 for (const auto& observer : observers_) |
| 942 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay); | 933 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay); |
| 943 } | 934 } |
| 944 | 935 |
| 945 } // namespace page_load_metrics | 936 } // namespace page_load_metrics |
| OLD | NEW |