| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_backoff_manager.h" | 5 #include "net/url_request/url_request_backoff_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 return false; | 121 return false; |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::string URLRequestBackoffManager::GetIdFromUrl(const GURL& url) const { | 124 std::string URLRequestBackoffManager::GetIdFromUrl(const GURL& url) const { |
| 125 if (!url.is_valid()) | 125 if (!url.is_valid()) |
| 126 return url.possibly_invalid_spec(); | 126 return url.possibly_invalid_spec(); |
| 127 | 127 |
| 128 GURL id = url.ReplaceComponents(url_id_replacements_); | 128 GURL id = url.ReplaceComponents(url_id_replacements_); |
| 129 return base::StringToLowerASCII(id.spec()).c_str(); | 129 return base::ToLowerASCII(id.spec()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void URLRequestBackoffManager::OnNetworkChange() { | 132 void URLRequestBackoffManager::OnNetworkChange() { |
| 133 CalledOnValidThread(); | 133 CalledOnValidThread(); |
| 134 | 134 |
| 135 new_entries_since_last_gc_ = 0; | 135 new_entries_since_last_gc_ = 0; |
| 136 // Remove all entries. | 136 // Remove all entries. |
| 137 for (UrlEntryMap::iterator it = url_entries_.begin(); | 137 for (UrlEntryMap::iterator it = url_entries_.begin(); |
| 138 it != url_entries_.end(); ++it) { | 138 it != url_entries_.end(); ++it) { |
| 139 delete it->second; | 139 delete it->second; |
| 140 } | 140 } |
| 141 url_entries_.clear(); | 141 url_entries_.clear(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace net | 144 } // namespace net |
| OLD | NEW |