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

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 2508933002: tools: Local tests for the speculative prefetch predictor. (Closed)
Patch Set: Rebase/ Created 4 years, 1 month 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/predictors/resource_prefetch_predictor.cc
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index b6e39e5d707a295876a082e6a697016941f4fe75..a399e30d75e3a12473b599d9e78137c64b98f400 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -393,8 +393,10 @@ ResourcePrefetchPredictor::~ResourcePrefetchPredictor() {}
void ResourcePrefetchPredictor::StartInitialization() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ TRACE_EVENT0("browser", "ResourcePrefetchPredictor::StartInitialization");
- DCHECK_EQ(NOT_INITIALIZED, initialization_state_);
+ if (initialization_state_ != NOT_INITIALIZED)
+ return;
initialization_state_ = INITIALIZING;
// Create local caches using the database as loaded.
@@ -521,7 +523,8 @@ void ResourcePrefetchPredictor::OnMainFrameRequest(
DCHECK_EQ(INITIALIZED, initialization_state_);
const GURL& main_frame_url = request.navigation_id.main_frame_url;
- StartPrefetching(main_frame_url);
+ if (!config_.ExternalPrefetchingOnly())
+ StartPrefetching(main_frame_url);
// Cleanup older navigations.
CleanupAbandonedNavigations(request.navigation_id);

Powered by Google App Engine
This is Rietveld 408576698