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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 i->second->DetachManager(); 42 i->second->DetachManager();
43 } 43 }
44 ++i; 44 ++i;
45 } 45 }
46 46
47 // Delete all entries. 47 // Delete all entries.
48 url_entries_.clear(); 48 url_entries_.clear();
49 } 49 }
50 50
51 scoped_refptr<URLRequestThrottlerEntryInterface> 51 scoped_refptr<URLRequestThrottlerEntryInterface>
52 URLRequestThrottlerManager::RegisterRequestUrl(const GURL &url) { 52 URLRequestThrottlerManager::RegisterRequestUrl(const GURL& url) {
53 DCHECK(!enable_thread_checks_ || CalledOnValidThread()); 53 DCHECK(!enable_thread_checks_ || CalledOnValidThread());
54 54
55 // Normalize the url. 55 // Normalize the url.
56 std::string url_id = GetIdFromUrl(url); 56 std::string url_id = GetIdFromUrl(url);
57 57
58 // Periodically garbage collect old entries. 58 // Periodically garbage collect old entries.
59 GarbageCollectEntriesIfNecessary(); 59 GarbageCollectEntriesIfNecessary();
60 60
61 // Find the entry in the map or create a new NULL entry. 61 // Find the entry in the map or create a new NULL entry.
62 scoped_refptr<URLRequestThrottlerEntry>& entry = url_entries_[url_id]; 62 scoped_refptr<URLRequestThrottlerEntry>& entry = url_entries_[url_id];
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void URLRequestThrottlerManager::set_enable_thread_checks(bool enable) { 134 void URLRequestThrottlerManager::set_enable_thread_checks(bool enable) {
135 enable_thread_checks_ = enable; 135 enable_thread_checks_ = enable;
136 } 136 }
137 137
138 bool URLRequestThrottlerManager::enable_thread_checks() const { 138 bool URLRequestThrottlerManager::enable_thread_checks() const {
139 return enable_thread_checks_; 139 return enable_thread_checks_;
140 } 140 }
141 141
142 void URLRequestThrottlerManager::set_net_log(NetLog* net_log) { 142 void URLRequestThrottlerManager::set_net_log(NetLog* net_log) {
143 DCHECK(net_log); 143 DCHECK(net_log);
144 net_log_ = BoundNetLog::Make(net_log, 144 net_log_ =
145 NetLog::SOURCE_EXPONENTIAL_BACKOFF_THROTTLING); 145 BoundNetLog::Make(net_log, NetLog::SOURCE_EXPONENTIAL_BACKOFF_THROTTLING);
146 } 146 }
147 147
148 NetLog* URLRequestThrottlerManager::net_log() const { 148 NetLog* URLRequestThrottlerManager::net_log() const {
149 return net_log_.net_log(); 149 return net_log_.net_log();
150 } 150 }
151 151
152 void URLRequestThrottlerManager::OnIPAddressChanged() { 152 void URLRequestThrottlerManager::OnIPAddressChanged() {
153 OnNetworkChange(); 153 OnNetworkChange();
154 } 154 }
155 155
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void URLRequestThrottlerManager::OnNetworkChange() { 194 void URLRequestThrottlerManager::OnNetworkChange() {
195 // Remove all entries. Any entries that in-flight requests have a reference 195 // Remove all entries. Any entries that in-flight requests have a reference
196 // to will live until those requests end, and these entries may be 196 // to will live until those requests end, and these entries may be
197 // inconsistent with new entries for the same URLs, but since what we 197 // inconsistent with new entries for the same URLs, but since what we
198 // want is a clean slate for the new connection type, this is OK. 198 // want is a clean slate for the new connection type, this is OK.
199 url_entries_.clear(); 199 url_entries_.clear();
200 requests_since_last_gc_ = 0; 200 requests_since_last_gc_ = 0;
201 } 201 }
202 202
203 } // namespace net 203 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698