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

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

Issue 10440119: Introduce a delegate to avoid hardcoding "chrome-extension" in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review requests. Created 8 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
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 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "base/threading/platform_thread.h" 16 #include "base/threading/platform_thread.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
19 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
20 #include "net/url_request/url_request_context.h"
eroman 2012/06/06 04:52:11 Is this header used?
Jói 2012/06/06 13:38:55 Only in the .cc file, moved it there.
20 #include "net/url_request/url_request_throttler_entry.h" 21 #include "net/url_request/url_request_throttler_entry.h"
21 22
22 namespace net { 23 namespace net {
23 24
24 class BoundNetLog; 25 class BoundNetLog;
25 class NetLog; 26 class NetLog;
26 27
27 // Class that registers URL request throttler entries for URLs being accessed 28 // Class that registers URL request throttler entries for URLs being accessed
28 // in order to supervise traffic. URL requests for HTTP contents should 29 // in order to supervise traffic. URL requests for HTTP contents should
29 // register their URLs in this manager on each request. 30 // register their URLs in this manager on each request.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Set of hosts that have opted out. 135 // Set of hosts that have opted out.
135 OptOutHosts opt_out_hosts_; 136 OptOutHosts opt_out_hosts_;
136 137
137 // This keeps track of how many requests have been made. Used with 138 // This keeps track of how many requests have been made. Used with
138 // GarbageCollectEntries. 139 // GarbageCollectEntries.
139 unsigned int requests_since_last_gc_; 140 unsigned int requests_since_last_gc_;
140 141
141 // Valid after construction. 142 // Valid after construction.
142 GURL::Replacements url_id_replacements_; 143 GURL::Replacements url_id_replacements_;
143 144
144 // Whether we would like to reject outgoing HTTP requests during the back-off
145 // period.
146 bool enforce_throttling_;
147
148 // Certain tests do not obey the net component's threading policy, so we 145 // Certain tests do not obey the net component's threading policy, so we
149 // keep track of whether we're being used by tests, and turn off certain 146 // keep track of whether we're being used by tests, and turn off certain
150 // checks. 147 // checks.
151 // 148 //
152 // TODO(joi): See if we can fix the offending unit tests and remove this 149 // TODO(joi): See if we can fix the offending unit tests and remove this
153 // workaround. 150 // workaround.
154 bool enable_thread_checks_; 151 bool enable_thread_checks_;
155 152
156 // Initially false, switches to true once we have logged because of back-off 153 // Initially false, switches to true once we have logged because of back-off
157 // being disabled for localhost. 154 // being disabled for localhost.
158 bool logged_for_localhost_disabled_; 155 bool logged_for_localhost_disabled_;
159 156
160 // NetLog to use, if configured. 157 // NetLog to use, if configured.
161 BoundNetLog net_log_; 158 BoundNetLog net_log_;
162 159
163 // Valid once we've registered for network notifications. 160 // Valid once we've registered for network notifications.
164 base::PlatformThreadId registered_from_thread_; 161 base::PlatformThreadId registered_from_thread_;
165 162
166 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); 163 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager);
167 }; 164 };
168 165
169 } // namespace net 166 } // namespace net
170 167
171 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ 168 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698