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

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

Issue 2907263002: [Not for review] Add TRACE_EVENTs and chrome://flags for preconnect
Patch Set: Created 3 years, 7 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/net/predictor.cc ('k') | content/public/common/content_features.h » ('j') | 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 20f4157dc7a7f79007760e8283694255455f9516..d8c0c4a579b010d0fab10bbb46eda85ea9a62673 100644
--- a/chrome/browser/net/predictor_tab_helper.cc
+++ b/chrome/browser/net/predictor_tab_helper.cc
@@ -5,11 +5,13 @@
#include "chrome/browser/net/predictor_tab_helper.h"
#include "base/feature_list.h"
+#include "base/trace_event/trace_event.h"
#include "chrome/browser/net/predictor.h"
#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"
+#include "content/public/common/content_features.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
@@ -38,6 +40,8 @@ PredictorTabHelper::~PredictorTabHelper() {
void PredictorTabHelper::DidStartNavigation(
content::NavigationHandle* navigation_handle) {
+ if (!base::FeatureList::IsEnabled(features::kPredictorPreconnect))
+ return;
if (!base::FeatureList::IsEnabled(kPreconnectMore) &&
(!content::IsBrowserSideNavigationEnabled() ||
navigation_handle->IsRendererInitiated()))
@@ -55,6 +59,8 @@ void PredictorTabHelper::DidStartNavigation(
void PredictorTabHelper::DidStartNavigationToPendingEntry(
const GURL& url,
content::ReloadType reload_type) {
+ if (!base::FeatureList::IsEnabled(features::kPredictorPreconnect))
+ return;
// This method isn't needed with PlzNavigate (see comment in header for
// predicted_from_pending_entry_)
if (content::IsBrowserSideNavigationEnabled())
@@ -78,6 +84,7 @@ void PredictorTabHelper::DocumentOnLoadCompletedInMainFrame() {
}
void PredictorTabHelper::PreconnectUrl(const GURL& url) {
+ TRACE_EVENT1("net", "PredictorTabHelper::PreconnectUrl", "url", url.spec());
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
Predictor* predictor(profile->GetNetworkPredictor());
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | content/public/common/content_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698