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

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

Issue 1967663002: Effectively disable the predictor's DNS queue for an experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on #393103 Created 4 years, 7 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 | testing/variations/fieldtrial_testing_config_android.json » ('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 65567ad87738ca5c622acbaeacb6648bf2b0dea7..1ac0dea58747efab6f0123ab8a768eadeb3cc11b 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/containers/mru_cache.h"
+#include "base/feature_list.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -56,6 +57,11 @@ using content::BrowserThread;
namespace chrome_browser_net {
+namespace {
+const base::Feature kUsePredictorDNSQueue{"UsePredictorDNSQueue",
+ base::FEATURE_ENABLED_BY_DEFAULT};
+}
+
// static
const int Predictor::kPredictorReferrerVersion = 2;
const double Predictor::kPreconnectWorthyExpectedValue = 0.8;
@@ -426,7 +432,8 @@ void Predictor::DiscardAllResults() {
assignees[url] = *info;
}
}
- DCHECK_LE(assignees.size(), max_concurrent_dns_lookups_);
+ DCHECK(!base::FeatureList::IsEnabled(kUsePredictorDNSQueue) ||
+ assignees.size() <= max_concurrent_dns_lookups_);
results_.clear();
// Put back in the names being worked on.
for (Results::iterator it = assignees.begin(); assignees.end() != it; ++it) {
@@ -1086,6 +1093,7 @@ UrlInfo* Predictor::AppendToResolutionQueue(
bool Predictor::CongestionControlPerformed(UrlInfo* info) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(base::FeatureList::IsEnabled(kUsePredictorDNSQueue));
// Note: queue_duration is ONLY valid after we go to assigned state.
if (info->queue_duration() < max_dns_queue_delay_)
return false;
@@ -1105,14 +1113,18 @@ bool Predictor::CongestionControlPerformed(UrlInfo* info) {
void Predictor::StartSomeQueuedResolutions() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ // If the queue is disabled, just make LookupRequests for all entries.
+ bool enable_queue = base::FeatureList::IsEnabled(kUsePredictorDNSQueue);
while (!work_queue_.IsEmpty() &&
- pending_lookups_.size() < max_concurrent_dns_lookups_) {
+ (!enable_queue ||
+ pending_lookups_.size() < max_concurrent_dns_lookups_)) {
const GURL url(work_queue_.Pop());
UrlInfo* info = &results_[url];
DCHECK(info->HasUrl(url));
info->SetAssignedState();
- if (CongestionControlPerformed(info)) {
+ // Only perform congestion control if the queue is enabled.
+ if (enable_queue && CongestionControlPerformed(info)) {
DCHECK(work_queue_.IsEmpty());
return;
}
« no previous file with comments | « no previous file | testing/variations/fieldtrial_testing_config_android.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698