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

Unified Diff: components/precache/content/precache_manager.cc

Issue 2229983002: Send the list of used and unused resources for precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: components/precache/content/precache_manager.cc
diff --git a/components/precache/content/precache_manager.cc b/components/precache/content/precache_manager.cc
index 8e6e1a6d568d578c36a2e39f09664b809492d506..1e38ddf3c134ab0713570b7b7c409b8a064720c6 100644
--- a/components/precache/content/precache_manager.cc
+++ b/components/precache/content/precache_manager.cc
@@ -142,8 +142,7 @@ void PrecacheManager::OnGetUnfinishedWorkDone(
base::Time::Now() - base::Time::FromInternalValue(
unfinished_work->start_time()) > base::TimeDelta::FromHours(6)) {
PrecacheFetcher::RecordCompletionStatistics(
- *unfinished_work,
- unfinished_work->manifest_size(),
+ *unfinished_work, unfinished_work->top_host_size(),
unfinished_work->resource_size());
unfinished_work.reset(new PrecacheUnfinishedWork());
unfinished_work->set_start_time(base::Time::Now().ToInternalValue());
@@ -251,12 +250,14 @@ void PrecacheManager::RecordStatsForFetch(const GURL& url,
return;
history_service_->HostRankIfAvailable(
- referrer, base::Bind(&PrecacheManager::RecordStatsForFetchInternal,
- AsWeakPtr(), url, latency, fetch_time, info, size));
+ referrer,
+ base::Bind(&PrecacheManager::RecordStatsForFetchInternal, AsWeakPtr(),
+ url, referrer.host(), latency, fetch_time, info, size));
}
void PrecacheManager::RecordStatsForFetchInternal(
const GURL& url,
+ const std::string& referrer_host,
const base::TimeDelta& latency,
const base::Time& fetch_time,
const net::HttpResponseInfo& info,
@@ -271,8 +272,8 @@ void PrecacheManager::RecordStatsForFetchInternal(
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
base::Bind(&PrecacheDatabase::RecordURLPrefetch,
- base::Unretained(precache_database_.get()), url, latency,
- fetch_time, info, size));
+ base::Unretained(precache_database_.get()), url,
+ referrer_host, fetch_time, info.was_cached, size));
} else {
bool is_connection_cellular =
net::NetworkChangeNotifier::IsConnectionCellular(
@@ -343,6 +344,9 @@ void PrecacheManager::InitializeAndStartFetcher() {
std::move(unfinished_work_),
metrics::HashName(
base::FieldTrialList::FindFullName(kPrecacheFieldTrialName)),
+ precache_database_->GetWeakPtr(),
+ content::BrowserThread::GetTaskRunnerForThread(
+ content::BrowserThread::DB),
this));
precache_fetcher_->Start();
}

Powered by Google App Engine
This is Rietveld 408576698