OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/precache/core/precache_database.h" | 5 #include "components/precache/core/precache_database.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 // buffer. | 249 // buffer. |
250 Flush(); | 250 Flush(); |
251 } | 251 } |
252 | 252 |
253 bool is_precached = precache_url_table_.IsURLPrecachedAndUnused(url); | 253 bool is_precached = precache_url_table_.IsURLPrecachedAndUnused(url); |
254 if (info.was_cached && !is_precached) { | 254 if (info.was_cached && !is_precached) { |
255 // Ignore cache hits that precache can't take credit for. | 255 // Ignore cache hits that precache can't take credit for. |
256 return; | 256 return; |
257 } | 257 } |
258 | 258 |
259 if (is_precached) | |
Raj
2016/09/26 22:09:58
nit: add the multiline statement inside parenthese
twifkak
2016/09/26 22:57:05
Done.
| |
260 UMA_HISTOGRAM_ENUMERATION( | |
261 "Precache.CacheStatus.NonPrefetch.FromPrecache", | |
262 info.cache_entry_status, | |
263 net::HttpResponseInfo::CacheEntryStatus::ENTRY_MAX); | |
264 | |
259 base::HistogramBase::Sample size_sample = | 265 base::HistogramBase::Sample size_sample = |
260 static_cast<base::HistogramBase::Sample>(size); | 266 static_cast<base::HistogramBase::Sample>(size); |
261 if (!info.was_cached) { | 267 if (!info.was_cached) { |
262 // The fetch was served over the network during user browsing, so count it | 268 // The fetch was served over the network during user browsing, so count it |
263 // as downloaded non-precache bytes. | 269 // as downloaded non-precache bytes. |
264 UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache", size_sample); | 270 UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache", size_sample); |
265 if (is_connection_cellular) { | 271 if (is_connection_cellular) { |
266 UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache.Cellular", | 272 UMA_HISTOGRAM_COUNTS("Precache.DownloadedNonPrecache.Cellular", |
267 size_sample); | 273 size_sample); |
268 } | 274 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 | 434 |
429 void PrecacheDatabase::DeleteUnfinishedWork() { | 435 void PrecacheDatabase::DeleteUnfinishedWork() { |
430 precache_session_table_.DeleteUnfinishedWork(); | 436 precache_session_table_.DeleteUnfinishedWork(); |
431 } | 437 } |
432 | 438 |
433 base::WeakPtr<PrecacheDatabase> PrecacheDatabase::GetWeakPtr() { | 439 base::WeakPtr<PrecacheDatabase> PrecacheDatabase::GetWeakPtr() { |
434 return weak_factory_.GetWeakPtr(); | 440 return weak_factory_.GetWeakPtr(); |
435 } | 441 } |
436 | 442 |
437 } // namespace precache | 443 } // namespace precache |
OLD | NEW |