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

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: address comments 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
Index: chrome/browser/net/predictor.cc
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index 9d2a80c98afaace21cf34892d7d8201f97969da6..2cd513fbf15d9cd14ec7fed56a15db65d6efc050 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/predictor/common/predictor_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() > predictor::kMaxDnsHostnamesPerRequest) {
+ LOG(ERROR) << "Refusing to prefetch too many hostnames: "
+ << hostnames.size();
Nico 2014/10/28 20:07:19 Don't do useless logging. If this is an invariant,
gunsch 2014/10/28 20:47:32 If it fails, that's a security issue, since this s
Nico 2014/10/28 20:56:42 It's logspam in the sense that printing this doesn
gunsch 2014/10/28 21:11:29 That sounds practical, can you point me to an exam
Nico 2014/10/28 21:31:18 https://code.google.com/p/chromium/codesearch#chro
Nico 2014/10/29 22:16:34 Even better, we even have a web page for this: htt
gunsch 2014/10/29 23:58:29 Yeah, I linked that earlier in this reply thread,
+ 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() > predictor::kMaxDnsHostnameLength) {
+ LOG(ERROR) << "Refusing to prefetch hostname with length: "
+ << it->length();
Nico 2014/10/28 20:07:19 likewise
gunsch 2014/10/29 23:58:29 Done.
+ continue;
+ }
urls.push_back(GURL("http://" + *it + ":80"));
}

Powered by Google App Engine
This is Rietveld 408576698