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 #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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 URLRequestThrottlerManager::~URLRequestThrottlerManager() { | 33 URLRequestThrottlerManager::~URLRequestThrottlerManager() { |
34 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 34 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
35 NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 35 NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
36 | 36 |
37 // Since the manager object might conceivably go away before the | 37 // Since the manager object might conceivably go away before the |
38 // entries, detach the entries' back-pointer to the manager. | 38 // entries, detach the entries' back-pointer to the manager. |
39 UrlEntryMap::iterator i = url_entries_.begin(); | 39 UrlEntryMap::iterator i = url_entries_.begin(); |
40 while (i != url_entries_.end()) { | 40 while (i != url_entries_.end()) { |
41 if (i->second != NULL) { | 41 if (i->second.get() != NULL) { |
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> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |