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

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

Issue 5961008: Give user the ability to disable the URL request throttler:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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_manager.h ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/string_util.h" 7 #include "base/string_util.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 // Find the entry in the map or create it. 26 // Find the entry in the map or create it.
27 scoped_refptr<URLRequestThrottlerEntry>& entry = url_entries_[url_id]; 27 scoped_refptr<URLRequestThrottlerEntry>& entry = url_entries_[url_id];
28 if (entry == NULL) 28 if (entry == NULL)
29 entry = new URLRequestThrottlerEntry(); 29 entry = new URLRequestThrottlerEntry();
30 30
31 return entry; 31 return entry;
32 } 32 }
33 33
34 URLRequestThrottlerManager::URLRequestThrottlerManager() 34 URLRequestThrottlerManager::URLRequestThrottlerManager()
35 : requests_since_last_gc_(0) { 35 : requests_since_last_gc_(0),
36 enforce_throttling_(true) {
36 } 37 }
37 38
38 URLRequestThrottlerManager::~URLRequestThrottlerManager() { 39 URLRequestThrottlerManager::~URLRequestThrottlerManager() {
39 // Delete all entries. 40 // Delete all entries.
40 url_entries_.clear(); 41 url_entries_.clear();
41 } 42 }
42 43
43 std::string URLRequestThrottlerManager::GetIdFromUrl(const GURL& url) const { 44 std::string URLRequestThrottlerManager::GetIdFromUrl(const GURL& url) const {
44 if (!url.is_valid()) 45 if (!url.is_valid())
45 return url.possibly_invalid_spec(); 46 return url.possibly_invalid_spec();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 url_entries_[url_id] = entry; 99 url_entries_[url_id] = entry;
99 } 100 }
100 101
101 void URLRequestThrottlerManager::EraseEntryForTests(const GURL& url) { 102 void URLRequestThrottlerManager::EraseEntryForTests(const GURL& url) {
102 // Normalize the url. 103 // Normalize the url.
103 std::string url_id = GetIdFromUrl(url); 104 std::string url_id = GetIdFromUrl(url);
104 url_entries_.erase(url_id); 105 url_entries_.erase(url_id);
105 } 106 }
106 107
107 } // namespace net 108 } // namespace net
OLDNEW
« 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