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

Unified Diff: content/browser/renderer_host/duplicate_content_resource_handler.cc

Issue 10824236: Only track http and https in duplicate resource handler metrics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/duplicate_content_resource_handler.cc
diff --git a/content/browser/renderer_host/duplicate_content_resource_handler.cc b/content/browser/renderer_host/duplicate_content_resource_handler.cc
index 0c7a8ba880ea28635801f8a6df42a4cf4be14e17..d63641a7adf082b90b383297e99eb9ae59c19451 100644
--- a/content/browser/renderer_host/duplicate_content_resource_handler.cc
+++ b/content/browser/renderer_host/duplicate_content_resource_handler.cc
@@ -89,17 +89,23 @@ bool DuplicateContentResourceHandler::OnResponseCompleted(
}
void DuplicateContentResourceHandler::RecordContentMetrics() {
+ // Ignore everything that's not http/https. Specifically, exclude data and
+ // blob URLs which can be generated by content and cause the maintained sets
+ // to grow without bounds.
+ if (!request_->url().SchemeIs("http") && !request_->url().SchemeIs("https")) {
gavinp 2012/08/09 20:20:45 I'm taking my LGTM back. This code calculates the
scottmg 2012/08/09 20:24:56 Sorry, you lost me? There's a return here, so if t
gavinp 2012/08/12 16:17:14 See my comment on line 74, above. On 2012/08/09 2
+ bytes_read_ = 0;
+ read_buffer_ = NULL;
+ return;
+ }
MH_UINT32 contents_hash = PMurHash32_Result(pmurhash_ph1_,
pmurhash_pcarry_, bytes_read_);
-
// Combine the contents_hash with the url, so we can test if future content
// identical resources have the same original url or not.
- MH_UINT32 hashed_with_url;
const std::string& url_spec = request_->url().spec();
PMurHash32_Process(&pmurhash_ph1_, &pmurhash_pcarry_,
url_spec.data(), url_spec.length());
- hashed_with_url = PMurHash32_Result(pmurhash_ph1_, pmurhash_pcarry_,
- url_spec.length() + bytes_read_);
+ MH_UINT32 hashed_with_url = PMurHash32_Result(
gavinp 2012/08/09 18:32:00 nice cleanup.
+ pmurhash_ph1_, pmurhash_pcarry_, url_spec.length() + bytes_read_);
DVLOG(4) << "url: " << url_spec;
DVLOG(4) << "contents hash: " << contents_hash;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698