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

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..a5626d23f902338e710a5a576484900729c20ec8 100644
--- a/content/browser/renderer_host/duplicate_content_resource_handler.cc
+++ b/content/browser/renderer_host/duplicate_content_resource_handler.cc
@@ -9,6 +9,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/string_util.h"
#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "net/base/io_buffer.h"
#include "net/url_request/url_request.h"
@@ -89,16 +90,21 @@ bool DuplicateContentResourceHandler::OnResponseCompleted(
}
void DuplicateContentResourceHandler::RecordContentMetrics() {
+ // Ignore data and blob URLs.
+ const std::string& url_spec = request_->url().spec();
+ if (StartsWithASCII(url_spec, "data:", false) ||
gavinp 2012/08/09 17:28:05 So since data URLs will usually have the same URL
+ StartsWithASCII(url_spec, "blob:", false)) {
+ 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_,
+ MH_UINT32 hashed_with_url = PMurHash32_Result(pmurhash_ph1_, pmurhash_pcarry_,
url_spec.length() + bytes_read_);
frankwang 2012/08/09 17:21:12 nit: indentation
DVLOG(4) << "url: " << url_spec;
« 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