Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: chrome/browser/page_load_metrics/page_load_tracker.cc

Issue 2624283004: Associate a main resource request with its PageLoadTracker. (Closed)
Patch Set: fix comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_tracker.h ('k') | chrome/test/data/page_load_metrics/large.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/page_load_metrics/page_load_tracker.cc
diff --git a/chrome/browser/page_load_metrics/page_load_tracker.cc b/chrome/browser/page_load_metrics/page_load_tracker.cc
index c96fb434f711fc5305f7d6a182e8efbcc0c0d7f6..6f161e9fa3d7913d4eba92157bb0c03939b0b0c4 100644
--- a/chrome/browser/page_load_metrics/page_load_tracker.cc
+++ b/chrome/browser/page_load_metrics/page_load_tracker.cc
@@ -18,6 +18,7 @@
#include "chrome/common/page_load_metrics/page_load_timing.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_handle.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "ui/base/page_transition_types.h"
// This macro invokes the specified method on each observer, passing the
@@ -425,6 +426,20 @@ void PageLoadTracker::WebContentsShown() {
INVOKE_AND_PRUNE_OBSERVERS(observers_, OnShown);
}
+void PageLoadTracker::WillProcessNavigationResponse(
+ content::NavigationHandle* navigation_handle) {
+ // PlzNavigate: NavigationHandle::GetGlobalRequestID() sometimes returns an
+ // uninitialized GlobalRequestID. Bail early in this case. See
+ // crbug.com/680841 for details.
+ if (content::IsBrowserSideNavigationEnabled() &&
+ navigation_handle->GetGlobalRequestID() == content::GlobalRequestID())
+ return;
+
+ DCHECK(!navigation_request_id_.has_value());
+ navigation_request_id_ = navigation_handle->GetGlobalRequestID();
+ DCHECK(navigation_request_id_.value() != content::GlobalRequestID());
+}
+
void PageLoadTracker::Commit(content::NavigationHandle* navigation_handle) {
committed_url_ = navigation_handle->GetURL();
// Some transitions (like CLIENT_REDIRECT) are only known at commit time.
@@ -596,6 +611,13 @@ PageLoadExtraInfo PageLoadTracker::ComputePageLoadExtraInfo() {
abort_user_initiated_info_, time_to_abort, metadata_);
}
+bool PageLoadTracker::HasMatchingNavigationRequestID(
+ const content::GlobalRequestID& request_id) const {
+ DCHECK(request_id != content::GlobalRequestID());
+ return navigation_request_id_.has_value() &&
+ navigation_request_id_.value() == request_id;
+}
+
void PageLoadTracker::NotifyAbort(UserAbortType abort_type,
UserInitiatedInfo user_initiated_info,
base::TimeTicks timestamp,
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_tracker.h ('k') | chrome/test/data/page_load_metrics/large.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698