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

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

Issue 1266243003: Tweaks to the precache triggering code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 4 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/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index c86931cb3bf8d25602259b320f04ef0ecfb7dc5a..e638fff85ac2155c997b498ada4e2f4d7eb1c4a3 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -111,16 +111,14 @@ void RecordPrecacheStatsOnUIThread(const GURL& url,
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Profile* profile = reinterpret_cast<Profile*>(profile_id);
- if (!g_browser_process->profile_manager()->IsValidProfile(profile)) {
+ if (!g_browser_process->profile_manager()->IsValidProfile(profile))
return;
- }
precache::PrecacheManager* precache_manager =
precache::PrecacheManagerFactory::GetForBrowserContext(profile);
- if (!precache_manager || !precache_manager->IsPrecachingAllowed()) {
- // |precache_manager| could be NULL if the profile is off the record.
+ // |precache_manager| could be NULL if the profile is off the record.
+ if (!precache_manager || !precache_manager->WouldRun())
return;
- }
precache_manager->RecordStatsForFetch(url, fetch_time, size, was_cached);
}
@@ -502,7 +500,8 @@ void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
// or missing, as is the case with chunked encoding.
int64 received_content_length = request->received_response_content_length();
- // Record precache metrics when a fetch is completed successfully.
+ // Record precache metrics when a fetch is completed successfully, if
+ // precaching is allowed.
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&RecordPrecacheStatsOnUIThread, request->url(),

Powered by Google App Engine
This is Rietveld 408576698