| 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/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 net_log_ = session->net_log(); | 330 net_log_ = session->net_log(); |
| 331 if (!is_main_cache) | 331 if (!is_main_cache) |
| 332 return; | 332 return; |
| 333 | 333 |
| 334 session->SetServerPushDelegate( | 334 session->SetServerPushDelegate( |
| 335 base::MakeUnique<HttpCacheLookupManager>(this)); | 335 base::MakeUnique<HttpCacheLookupManager>(this)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 HttpCache::~HttpCache() { | 338 HttpCache::~HttpCache() { |
| 339 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); |
| 339 // Transactions should see an invalid cache after this point; otherwise they | 340 // Transactions should see an invalid cache after this point; otherwise they |
| 340 // could see an inconsistent object (half destroyed). | 341 // could see an inconsistent object (half destroyed). |
| 341 weak_factory_.InvalidateWeakPtrs(); | 342 weak_factory_.InvalidateWeakPtrs(); |
| 342 | 343 |
| 343 // If we have any active entries remaining, then we need to deactivate them. | 344 // If we have any active entries remaining, then we need to deactivate them. |
| 344 // We may have some pending calls to OnProcessPendingQueue, but since those | 345 // We may have some pending calls to OnProcessPendingQueue, but since those |
| 345 // won't run (due to our destruction), we can simply ignore the corresponding | 346 // won't run (due to our destruction), we can simply ignore the corresponding |
| 346 // will_process_pending_queue flag. | 347 // will_process_pending_queue flag. |
| 347 while (!active_entries_.empty()) { | 348 while (!active_entries_.empty()) { |
| 348 ActiveEntry* entry = active_entries_.begin()->second.get(); | 349 ActiveEntry* entry = active_entries_.begin()->second.get(); |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 building_backend_ = false; | 1178 building_backend_ = false; |
| 1178 DeletePendingOp(pending_op); | 1179 DeletePendingOp(pending_op); |
| 1179 } | 1180 } |
| 1180 | 1181 |
| 1181 // The cache may be gone when we return from the callback. | 1182 // The cache may be gone when we return from the callback. |
| 1182 if (!item->DoCallback(result, disk_cache_.get())) | 1183 if (!item->DoCallback(result, disk_cache_.get())) |
| 1183 item->NotifyTransaction(result, NULL); | 1184 item->NotifyTransaction(result, NULL); |
| 1184 } | 1185 } |
| 1185 | 1186 |
| 1186 } // namespace net | 1187 } // namespace net |
| OLD | NEW |