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

Side by Side Diff: net/url_request/url_request_throttler_manager.cc

Issue 7027040: Implement A/B experiment for anti-DDoS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Extend trial cut-off date to July 23rd. Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_throttler_entry.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_throttler_manager.h" 5 #include "net/url_request/url_request_throttler_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 void URLRequestThrottlerManager::AddToOptOutList(const std::string& host) { 84 void URLRequestThrottlerManager::AddToOptOutList(const std::string& host) {
85 // There is an edge case here that we are not handling, to keep things 85 // There is an edge case here that we are not handling, to keep things
86 // simple. If a host starts adding the opt-out header to its responses 86 // simple. If a host starts adding the opt-out header to its responses
87 // after there are already one or more entries in url_entries_ for that 87 // after there are already one or more entries in url_entries_ for that
88 // host, the pre-existing entries may still perform back-off throttling. 88 // host, the pre-existing entries may still perform back-off throttling.
89 // In practice, this would almost never occur. 89 // In practice, this would almost never occur.
90 if (opt_out_hosts_.find(host) == opt_out_hosts_.end()) { 90 if (opt_out_hosts_.find(host) == opt_out_hosts_.end()) {
91 UMA_HISTOGRAM_COUNTS("Throttling.SiteOptedOut", 1); 91 UMA_HISTOGRAM_COUNTS("Throttling.SiteOptedOut", 1);
92 if (base::FieldTrialList::TrialExists("ThrottlingEnabled")) { 92 if (base::FieldTrialList::TrialExists("HttpThrottlingEnabled")) {
93 UMA_HISTOGRAM_COUNTS(base::FieldTrial::MakeName( 93 UMA_HISTOGRAM_COUNTS(base::FieldTrial::MakeName(
94 "Throttling.SiteOptedOut", "ThrottlingEnabled"), 1); 94 "Throttling.SiteOptedOut", "HttpThrottlingEnabled"), 1);
95 } 95 }
96 96
97 net_log_->EndEvent( 97 net_log_->EndEvent(
98 NetLog::TYPE_THROTTLING_DISABLED_FOR_HOST, 98 NetLog::TYPE_THROTTLING_DISABLED_FOR_HOST,
99 make_scoped_refptr(new NetLogStringParameter("host", host))); 99 make_scoped_refptr(new NetLogStringParameter("host", host)));
100 opt_out_hosts_.insert(host); 100 opt_out_hosts_.insert(host);
101 } 101 }
102 } 102 }
103 103
104 void URLRequestThrottlerManager::OverrideEntryForTests( 104 void URLRequestThrottlerManager::OverrideEntryForTests(
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void URLRequestThrottlerManager::OnNetworkChange() { 242 void URLRequestThrottlerManager::OnNetworkChange() {
243 // Remove all entries. Any entries that in-flight requests have a reference 243 // Remove all entries. Any entries that in-flight requests have a reference
244 // to will live until those requests end, and these entries may be 244 // to will live until those requests end, and these entries may be
245 // inconsistent with new entries for the same URLs, but since what we 245 // inconsistent with new entries for the same URLs, but since what we
246 // want is a clean slate for the new connection state, this is OK. 246 // want is a clean slate for the new connection state, this is OK.
247 url_entries_.clear(); 247 url_entries_.clear();
248 requests_since_last_gc_ = 0; 248 requests_since_last_gc_ = 0;
249 } 249 }
250 250
251 } // namespace net 251 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_throttler_entry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698