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; |