| OLD | NEW |
| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
| 17 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
| 18 #include "net/url_request/url_request_throttler_entry.h" | 18 #include "net/url_request/url_request_throttler_entry.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class BoundNetLog; | 23 class NetLogWithSource; |
| 24 class NetLog; | 24 class NetLog; |
| 25 | 25 |
| 26 // Class that registers URL request throttler entries for URLs being accessed | 26 // Class that registers URL request throttler entries for URLs being accessed |
| 27 // in order to supervise traffic. URL requests for HTTP contents should | 27 // in order to supervise traffic. URL requests for HTTP contents should |
| 28 // register their URLs in this manager on each request. | 28 // register their URLs in this manager on each request. |
| 29 // | 29 // |
| 30 // URLRequestThrottlerManager maintains a map of URL IDs to URL request | 30 // URLRequestThrottlerManager maintains a map of URL IDs to URL request |
| 31 // throttler entries. It creates URL request throttler entries when new URLs | 31 // throttler entries. It creates URL request throttler entries when new URLs |
| 32 // are registered, and does garbage collection from time to time in order to | 32 // are registered, and does garbage collection from time to time in order to |
| 33 // clean out outdated entries. URL ID consists of lowercased scheme, host, port | 33 // clean out outdated entries. URL ID consists of lowercased scheme, host, port |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // | 134 // |
| 135 // TODO(joi): See if we can fix the offending unit tests and remove this | 135 // TODO(joi): See if we can fix the offending unit tests and remove this |
| 136 // workaround. | 136 // workaround. |
| 137 bool enable_thread_checks_; | 137 bool enable_thread_checks_; |
| 138 | 138 |
| 139 // Initially false, switches to true once we have logged because of back-off | 139 // Initially false, switches to true once we have logged because of back-off |
| 140 // being disabled for localhost. | 140 // being disabled for localhost. |
| 141 bool logged_for_localhost_disabled_; | 141 bool logged_for_localhost_disabled_; |
| 142 | 142 |
| 143 // NetLog to use, if configured. | 143 // NetLog to use, if configured. |
| 144 BoundNetLog net_log_; | 144 NetLogWithSource net_log_; |
| 145 | 145 |
| 146 // Valid once we've registered for network notifications. | 146 // Valid once we've registered for network notifications. |
| 147 base::PlatformThreadId registered_from_thread_; | 147 base::PlatformThreadId registered_from_thread_; |
| 148 | 148 |
| 149 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); | 149 DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 } // namespace net | 152 } // namespace net |
| 153 | 153 |
| 154 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ | 154 #endif // NET_URL_REQUEST_URL_REQUEST_THROTTLER_MANAGER_H_ |
| OLD | NEW |