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

Unified Diff: net/url_request/url_request_throttler_manager.cc

Issue 6382003: Reorder the methods in net/url_request/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiling net_unittests != compiling the rest of chrome Created 9 years, 11 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 | « net/url_request/url_request_throttler_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_throttler_manager.cc
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index 04e05c9af017af5be8cfa9a21e036b2ecb0f7b53..f71cf52b86b76ef8cd6d4888b55b2e1f1c000e9a 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -31,6 +31,27 @@ scoped_refptr<URLRequestThrottlerEntryInterface>
return entry;
}
+void URLRequestThrottlerManager::OverrideEntryForTests(
+ const GURL& url,
+ URLRequestThrottlerEntry* entry) {
+ if (entry == NULL)
+ return;
+
+ // Normalize the url.
+ std::string url_id = GetIdFromUrl(url);
+
+ // Periodically garbage collect old entries.
+ GarbageCollectEntriesIfNecessary();
+
+ url_entries_[url_id] = entry;
+}
+
+void URLRequestThrottlerManager::EraseEntryForTests(const GURL& url) {
+ // Normalize the url.
+ std::string url_id = GetIdFromUrl(url);
+ url_entries_.erase(url_id);
+}
+
URLRequestThrottlerManager::URLRequestThrottlerManager()
: requests_since_last_gc_(0),
enforce_throttling_(true) {
@@ -58,6 +79,15 @@ std::string URLRequestThrottlerManager::GetIdFromUrl(const GURL& url) const {
return StringToLowerASCII(id.spec());
}
+void URLRequestThrottlerManager::GarbageCollectEntriesIfNecessary() {
+ requests_since_last_gc_++;
+ if (requests_since_last_gc_ < kRequestsBetweenCollecting)
+ return;
+
+ requests_since_last_gc_ = 0;
+ GarbageCollectEntries();
+}
+
void URLRequestThrottlerManager::GarbageCollectEntries() {
UrlEntryMap::iterator i = url_entries_.begin();
@@ -75,34 +105,4 @@ void URLRequestThrottlerManager::GarbageCollectEntries() {
}
}
-void URLRequestThrottlerManager::GarbageCollectEntriesIfNecessary() {
- requests_since_last_gc_++;
- if (requests_since_last_gc_ < kRequestsBetweenCollecting)
- return;
-
- requests_since_last_gc_ = 0;
- GarbageCollectEntries();
-}
-
-void URLRequestThrottlerManager::OverrideEntryForTests(
- const GURL& url,
- URLRequestThrottlerEntry* entry) {
- if (entry == NULL)
- return;
-
- // Normalize the url.
- std::string url_id = GetIdFromUrl(url);
-
- // Periodically garbage collect old entries.
- GarbageCollectEntriesIfNecessary();
-
- url_entries_[url_id] = entry;
-}
-
-void URLRequestThrottlerManager::EraseEntryForTests(const GURL& url) {
- // Normalize the url.
- std::string url_id = GetIdFromUrl(url);
- url_entries_.erase(url_id);
-}
-
} // namespace net
« no previous file with comments | « net/url_request/url_request_throttler_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698