Chromium Code Reviews| 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 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 } | 596 } |
| 597 | 597 |
| 598 void HttpCache::CloseIdleConnections() { | 598 void HttpCache::CloseIdleConnections() { |
| 599 HttpNetworkSession* session = GetSession(); | 599 HttpNetworkSession* session = GetSession(); |
| 600 if (session) | 600 if (session) |
| 601 session->CloseIdleConnections(); | 601 session->CloseIdleConnections(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void HttpCache::OnExternalCacheHit(const GURL& url, | 604 void HttpCache::OnExternalCacheHit(const GURL& url, |
| 605 const std::string& http_method) { | 605 const std::string& http_method) { |
| 606 if (!disk_cache_.get()) | 606 if (!disk_cache_.get() || mode_ == DISABLE) |
| 607 return; | 607 return; |
| 608 | 608 |
| 609 HttpRequestInfo request_info; | 609 HttpRequestInfo request_info; |
| 610 request_info.url = url; | 610 request_info.url = url; |
| 611 request_info.method = http_method; | 611 request_info.method = http_method; |
| 612 std::string key = GenerateCacheKey(&request_info); | 612 std::string key = GenerateCacheKey(&request_info); |
| 613 disk_cache_->OnExternalCacheHit(key); | 613 disk_cache_->OnExternalCacheHit(key); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void HttpCache::InitializeInfiniteCache(const base::FilePath& path) { | 616 void HttpCache::InitializeInfiniteCache(const base::FilePath& path) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 int rv = disk_cache_->DoomEntry(key, pending_op->callback); | 798 int rv = disk_cache_->DoomEntry(key, pending_op->callback); |
| 799 if (rv != ERR_IO_PENDING) { | 799 if (rv != ERR_IO_PENDING) { |
| 800 item->ClearTransaction(); | 800 item->ClearTransaction(); |
| 801 pending_op->callback.Run(rv); | 801 pending_op->callback.Run(rv); |
| 802 } | 802 } |
| 803 | 803 |
| 804 return rv; | 804 return rv; |
| 805 } | 805 } |
| 806 | 806 |
| 807 void HttpCache::DoomMainEntryForUrl(const GURL& url) { | 807 void HttpCache::DoomMainEntryForUrl(const GURL& url) { |
| 808 if (!disk_cache_) | 808 if (!disk_cache_ || mode_ == DISABLE) |
|
rvargas (doing something else)
2014/12/04 02:35:14
This one should not be needed. (it is already cove
| |
| 809 return; | 809 return; |
| 810 | 810 |
| 811 HttpRequestInfo temp_info; | 811 HttpRequestInfo temp_info; |
| 812 temp_info.url = url; | 812 temp_info.url = url; |
| 813 temp_info.method = "GET"; | 813 temp_info.method = "GET"; |
| 814 std::string key = GenerateCacheKey(&temp_info); | 814 std::string key = GenerateCacheKey(&temp_info); |
| 815 | 815 |
| 816 // Defer to DoomEntry if there is an active entry, otherwise call | 816 // Defer to DoomEntry if there is an active entry, otherwise call |
| 817 // AsyncDoomEntry without triggering a callback. | 817 // AsyncDoomEntry without triggering a callback. |
| 818 if (active_entries_.count(key)) | 818 if (active_entries_.count(key)) |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1406 building_backend_ = false; | 1406 building_backend_ = false; |
| 1407 DeletePendingOp(pending_op); | 1407 DeletePendingOp(pending_op); |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 // The cache may be gone when we return from the callback. | 1410 // The cache may be gone when we return from the callback. |
| 1411 if (!item->DoCallback(result, disk_cache_.get())) | 1411 if (!item->DoCallback(result, disk_cache_.get())) |
| 1412 item->NotifyTransaction(result, NULL); | 1412 item->NotifyTransaction(result, NULL); |
| 1413 } | 1413 } |
| 1414 | 1414 |
| 1415 } // namespace net | 1415 } // namespace net |
| OLD | NEW |