| Index: components/precache/core/precache_database.cc
|
| diff --git a/components/precache/core/precache_database.cc b/components/precache/core/precache_database.cc
|
| index 1703521491f8679449363295dc2a86795df76af2..8650262a405707f64b27a55199c29dec8995cdb6 100644
|
| --- a/components/precache/core/precache_database.cc
|
| +++ b/components/precache/core/precache_database.cc
|
| @@ -198,7 +198,8 @@ void PrecacheDatabase::RecordURLPrefetch(const GURL& url,
|
| // then the timestamp is updated.
|
| buffered_writes_.push_back(base::Bind(
|
| &PrecacheDatabase::RecordURLPrefetchInternal, GetWeakPtr(), url,
|
| - referrer_host, !was_cached || precache_url_table_.IsURLPrecached(url),
|
| + referrer_host,
|
| + !was_cached || precache_url_table_.GetURLInfo(url).is_precached,
|
| fetch_time));
|
| buffered_urls_.insert(url.spec());
|
| MaybePostFlush();
|
| @@ -254,10 +255,13 @@ void PrecacheDatabase::RecordURLNonPrefetch(const GURL& url,
|
| Flush();
|
| }
|
|
|
| - bool is_precached = precache_url_table_.IsURLPrecachedAndUnused(url);
|
| - if (info.was_cached && !is_precached) {
|
| - // Ignore cache hits that precache can't take credit for.
|
| - return;
|
| + const PrecacheURLInfo url_info = precache_url_table_.GetURLInfo(url);
|
| +
|
| + if (url_info.was_precached) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Precache.CacheStatus.NonPrefetch.FromPrecache",
|
| + info.cache_entry_status,
|
| + net::HttpResponseInfo::CacheEntryStatus::ENTRY_MAX);
|
| }
|
|
|
| base::HistogramBase::Sample size_sample =
|
| @@ -279,7 +283,8 @@ void PrecacheDatabase::RecordURLNonPrefetch(const GURL& url,
|
| base::Unretained(&precache_url_table_), url));
|
| buffered_urls_.insert(url.spec());
|
| MaybePostFlush();
|
| - } else { // info.was_cached.
|
| + } else if (/* info.was_cached && */ url_info.is_precached &&
|
| + !url_info.was_used) {
|
| // The fetch was served from the cache, and since there's an entry for this
|
| // URL in the URL table, this means that the resource was served from the
|
| // cache only because precaching put it there. Thus, precaching was helpful,
|
|
|