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

Unified Diff: chrome/browser/net/predictor_tab_helper.cc

Issue 2559203003: Fix PredictorTabHelper to work with PlzNavigate. (Closed)
Patch Set: review comments Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor_tab_helper.cc
diff --git a/chrome/browser/net/predictor_tab_helper.cc b/chrome/browser/net/predictor_tab_helper.cc
index ae3aea5eec37d83b3cc3424aa071763bea06a005..7b08a015ae93e225dd79791c8b159d7779c08c09 100644
--- a/chrome/browser/net/predictor_tab_helper.cc
+++ b/chrome/browser/net/predictor_tab_helper.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_handle.h"
+#include "content/public/common/browser_side_navigation_policy.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(chrome_browser_net::PredictorTabHelper);
@@ -17,8 +18,8 @@ namespace chrome_browser_net {
namespace {
-// Triggers the preconnector on the new navigation api. This captures more
-// navigations.
+// Triggers the preconnector on renderer-initiated navigations. This captures
+// more navigations.
const base::Feature kPreconnectMore{"PreconnectMore",
base::FEATURE_DISABLED_BY_DEFAULT};
@@ -34,7 +35,9 @@ PredictorTabHelper::~PredictorTabHelper() {
void PredictorTabHelper::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
- if (!base::FeatureList::IsEnabled(kPreconnectMore))
+ if (!base::FeatureList::IsEnabled(kPreconnectMore) &&
+ (!content::IsBrowserSideNavigationEnabled() ||
+ navigation_handle->IsRendererInitiated()))
Charlie Harrison 2016/12/09 17:23:10 Note: IsRendererInitiated is a flaky api (crbug.co
return;
// Subframe navigations are handled in WitnessURLRequest.
if (!navigation_handle->IsInMainFrame())
@@ -49,6 +52,11 @@ void PredictorTabHelper::DidStartNavigation(
void PredictorTabHelper::DidStartNavigationToPendingEntry(
const GURL& url,
content::ReloadType reload_type) {
+ // This method isn't needed with PlzNavigate (see comment in header for
+ // predicted_from_pending_entry_)
+ if (content::IsBrowserSideNavigationEnabled())
Charlie Harrison 2016/12/09 17:23:10 Is the method still called in PlzNavigate mode? If
jam 2016/12/09 17:28:48 Yes it is, but it's planned to be removed.
+ return;
+
// The standard way to preconnect based on navigation.
PreconnectUrl(url);
predicted_from_pending_entry_ = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698