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

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

Issue 2624283004: Associate a main resource request with its PageLoadTracker. (Closed)
Patch Set: comment cleanup 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
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..5716b3a7f5a237d80ee3fd21f10e21056b09e733 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::ReadyToCommit(
+ content::NavigationHandle* navigation_handle) {
+ // When browser side navigation is enabled,
Charlie Harrison 2017/01/13 15:56:23 nit: Just replace this line with "PlzNavigate:", w
Bryan McQuade 2017/01/17 15:06:26 done
+ // 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());
Charlie Harrison 2017/01/13 15:56:23 nit: DCHECK_NE
Bryan McQuade 2017/01/17 15:06:26 i tried this but it doesn't compile, as DCHECK_NE
+}
+
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());
Charlie Harrison 2017/01/13 15:56:23 ditto
Bryan McQuade 2017/01/17 15:06:26 same
+ 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,

Powered by Google App Engine
This is Rietveld 408576698