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 38da8f3bd7b0fc8a7492cef49a0666fd027c8668..2df7273d9d39ebc59d13276528d9ed0f35d00fa2 100644 |
| --- a/net/http/http_cache_transaction.cc |
| +++ b/net/http/http_cache_transaction.cc |
| @@ -2704,6 +2704,37 @@ void HttpCache::Transaction::RecordHistograms() { |
| cache_->mode() != NORMAL || request_->method != "GET") { |
| return; |
| } |
| + |
| + std::string mime_type; |
| + if (GetResponseInfo()->headers && |
|
Deprecated (see juliatuttle)
2016/03/23 19:28:48
Do you have a sense from local testing that these
jkarlin
2016/03/24 11:09:00
Nothing extensive, but it seems to have good cover
|
| + GetResponseInfo()->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. |
| + if (mime_type == "text/html" && (request_->load_flags & LOAD_MAIN_FRAME)) { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.MainFrameHTML"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (mime_type == "text/html") { |
| + UMA_HISTOGRAM_ENUMERATION( |
| + std::string("HttpCache.Pattern.NonMainFrameHTML"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (mime_type == "text/css") { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.CSS"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (base::StartsWith(mime_type, "image/", |
| + base::CompareCase::SENSITIVE)) { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.Image"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (base::EndsWith(mime_type, "javascript", |
|
Deprecated (see juliatuttle)
2016/03/23 19:28:48
Did you want to check for ecmascript as well?
jkarlin
2016/03/24 11:09:00
Done.
|
| + base::CompareCase::SENSITIVE)) { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.JavaScript"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } else if (mime_type.find("font") != std::string::npos) { |
| + UMA_HISTOGRAM_ENUMERATION(std::string("HttpCache.Pattern.Font"), |
| + transaction_pattern_, PATTERN_MAX); |
| + } |
| + } |
| + |
| UMA_HISTOGRAM_ENUMERATION( |
| "HttpCache.Pattern", transaction_pattern_, PATTERN_MAX); |
| if (transaction_pattern_ == PATTERN_NOT_COVERED) |