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

Unified Diff: chrome/browser/net/predictor.cc

Issue 644123002: Componentize renderer side of DNS prefetching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LOG(ERROR) --> LOG(DFATAL) for IPC checks Created 6 years, 2 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 | « chrome/browser/net/predictor.h ('k') | chrome/browser/net/predictor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor.cc
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index 9d2a80c98afaace21cf34892d7d8201f97969da6..fb77d62913524c2e96f1fc07bd4581a727b8101a 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -33,6 +33,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
+#include "components/dns_prefetch/common/prefetch_common.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/address_list.h"
@@ -736,12 +737,23 @@ void Predictor::LearnAboutInitialNavigation(const GURL& url) {
// includes both Page-Scan, and Link-Hover prefetching.
// TODO(jar): Separate out link-hover prefetching, and page-scan results.
void Predictor::DnsPrefetchList(const NameList& hostnames) {
+ if (hostnames.size() > dns_prefetch::kMaxDnsHostnamesPerRequest) {
+ LOG(DFATAL) << "Refusing to prefetch too many hostnames: "
jar (doing other things) 2014/10/28 22:49:32 nit: Please use DLOG. No one will look at this...
gunsch 2014/10/29 23:58:29 Covered by removing this and doing validation with
+ << hostnames.size();
+ return;
+ }
+
// TODO(jar): Push GURL transport further back into renderer, but this will
// require a Webkit change in the observer :-/.
UrlList urls;
for (NameList::const_iterator it = hostnames.begin();
it < hostnames.end();
++it) {
+ if (it->length() > dns_prefetch::kMaxDnsHostnameLength) {
+ LOG(DFATAL) << "Refusing to prefetch hostname with length: "
jar (doing other things) 2014/10/28 22:49:32 nit: DLOG
gunsch 2014/10/29 23:58:29 ditto
+ << it->length();
+ continue;
+ }
urls.push_back(GURL("http://" + *it + ":80"));
}
« no previous file with comments | « chrome/browser/net/predictor.h ('k') | chrome/browser/net/predictor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698