Chromium Code Reviews| Index: net/http/http_cache_transaction.cc |
| diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc |
| index 178df98d6e1a1876fc748eb89d4bb43202fb284a..e17700809310715da051d4e0b43471426afca336 100644 |
| --- a/net/http/http_cache_transaction.cc |
| +++ b/net/http/http_cache_transaction.cc |
| @@ -2706,8 +2706,8 @@ void HttpCache::Transaction::RecordHistograms() { |
| } |
| std::string mime_type; |
| - if (GetResponseInfo()->headers && |
| - GetResponseInfo()->headers->GetMimeType(&mime_type)) { |
| + HttpResponseHeaders* response_headers = GetResponseInfo()->headers.get(); |
| + if (response_headers && response_headers->GetMimeType(&mime_type)) { |
| // Record the cache pattern by resource type. The type is inferred by |
| // response header mime type, which could be incorrect, so this is just an |
| // estimate. |
| @@ -2723,8 +2723,16 @@ void HttpCache::Transaction::RecordHistograms() { |
| transaction_pattern_, PATTERN_MAX); |
| } else if (base::StartsWith(mime_type, "image/", |
| base::CompareCase::SENSITIVE)) { |
| - UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.Image"), |
| + int64_t content_length = response_headers->GetContentLength(); |
| + if (content_length >= 0 && content_length < 100) |
|
Deprecated (see juliatuttle)
2016/04/14 14:30:18
Looks like you're missing a {?
jkarlin
2016/04/14 14:54:58
*head smack* Done.
|
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.TinyImage"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (content_length >= 100) { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.NonTinyImage"), |
| transaction_pattern_, PATTERN_MAX); |
| + } |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.Image"), |
| + transaction_pattern_, PATTERN_MAX); |
| } else if (base::EndsWith(mime_type, "javascript", |
| base::CompareCase::SENSITIVE) || |
| base::EndsWith(mime_type, "ecmascript", |