Chromium Code Reviews| 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 | 525 DCHECK(navigation_handle->GetGlobalRequestID() != content::GlobalRequestID()); |
|
Charlie Reis
2017/05/15 20:07:43
This looks possibly redundant with line 528 now th
Charlie Harrison
2017/05/15 21:45:54
Done.
| |
| 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()); | 526 DCHECK(!navigation_request_id_.has_value()); |
| 535 navigation_request_id_ = navigation_handle->GetGlobalRequestID(); | 527 navigation_request_id_ = navigation_handle->GetGlobalRequestID(); |
| 536 DCHECK(navigation_request_id_.value() != content::GlobalRequestID()); | 528 DCHECK(navigation_request_id_.value() != content::GlobalRequestID()); |
| 537 } | 529 } |
| 538 | 530 |
| 539 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) { | 531 void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) { |
| 540 did_commit_ = true; | 532 did_commit_ = true; |
| 541 url_ = navigation_handle->GetURL(); | 533 url_ = navigation_handle->GetURL(); |
| 542 // Some transitions (like CLIENT_REDIRECT) are only known at commit time. | 534 // Some transitions (like CLIENT_REDIRECT) are only known at commit time. |
| 543 page_transition_ = navigation_handle->GetPageTransition(); | 535 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); | 928 observer->MediaStartedPlaying(video_type, is_in_main_frame); |
| 937 } | 929 } |
| 938 | 930 |
| 939 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay, | 931 void PageLoadTracker::OnNavigationDelayComplete(base::TimeDelta scheduled_delay, |
| 940 base::TimeDelta actual_delay) { | 932 base::TimeDelta actual_delay) { |
| 941 for (const auto& observer : observers_) | 933 for (const auto& observer : observers_) |
| 942 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay); | 934 observer->OnNavigationDelayComplete(scheduled_delay, actual_delay); |
| 943 } | 935 } |
| 944 | 936 |
| 945 } // namespace page_load_metrics | 937 } // namespace page_load_metrics |
| OLD | NEW |