OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/cache_storage/cache_storage_cache.h" | 5 #include "content/browser/cache_storage/cache_storage_cache.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 response.headers)) { | 728 response.headers)) { |
729 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); | 729 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); |
730 return; | 730 return; |
731 } | 731 } |
732 | 732 |
733 if (query_cache_results->query_type == QueryCacheType::CACHE_ENTRIES) { | 733 if (query_cache_results->query_type == QueryCacheType::CACHE_ENTRIES) { |
734 query_cache_results->out_entries.push_back(std::move(entry)); | 734 query_cache_results->out_entries.push_back(std::move(entry)); |
735 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); | 735 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); |
736 return; | 736 return; |
737 } | 737 } |
| 738 |
| 739 query_cache_results->out_requests->push_back(request); |
| 740 if (query_cache_results->query_type == QueryCacheType::REQUESTS) { |
| 741 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); |
| 742 return; |
| 743 } |
| 744 |
738 DCHECK_EQ(QueryCacheType::REQUESTS_AND_RESPONSES, | 745 DCHECK_EQ(QueryCacheType::REQUESTS_AND_RESPONSES, |
739 query_cache_results->query_type); | 746 query_cache_results->query_type); |
740 | 747 |
741 query_cache_results->out_requests->push_back(request); | |
742 | |
743 if (entry->GetDataSize(INDEX_RESPONSE_BODY) == 0) { | 748 if (entry->GetDataSize(INDEX_RESPONSE_BODY) == 0) { |
744 query_cache_results->out_responses->push_back(response); | 749 query_cache_results->out_responses->push_back(response); |
745 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); | 750 QueryCacheProcessNextEntry(std::move(query_cache_results), iter + 1); |
746 return; | 751 return; |
747 } | 752 } |
748 | 753 |
749 if (!blob_storage_context_) { | 754 if (!blob_storage_context_) { |
750 query_cache_results->callback.Run(CACHE_STORAGE_ERROR_STORAGE, | 755 query_cache_results->callback.Run(CACHE_STORAGE_ERROR_STORAGE, |
751 std::unique_ptr<QueryCacheResults>()); | 756 std::unique_ptr<QueryCacheResults>()); |
752 return; | 757 return; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 void CacheStorageCache::KeysImpl( | 1260 void CacheStorageCache::KeysImpl( |
1256 std::unique_ptr<ServiceWorkerFetchRequest> request, | 1261 std::unique_ptr<ServiceWorkerFetchRequest> request, |
1257 const CacheStorageCacheQueryParams& options, | 1262 const CacheStorageCacheQueryParams& options, |
1258 const RequestsCallback& callback) { | 1263 const RequestsCallback& callback) { |
1259 DCHECK_NE(BACKEND_UNINITIALIZED, backend_state_); | 1264 DCHECK_NE(BACKEND_UNINITIALIZED, backend_state_); |
1260 if (backend_state_ != BACKEND_OPEN) { | 1265 if (backend_state_ != BACKEND_OPEN) { |
1261 callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Requests>()); | 1266 callback.Run(CACHE_STORAGE_ERROR_STORAGE, std::unique_ptr<Requests>()); |
1262 return; | 1267 return; |
1263 } | 1268 } |
1264 | 1269 |
1265 QueryCache(std::move(request), options, | 1270 QueryCache(std::move(request), options, QueryCacheType::REQUESTS, |
1266 QueryCacheType::REQUESTS_AND_RESPONSES, | |
1267 base::Bind(&CacheStorageCache::KeysDidQueryCache, | 1271 base::Bind(&CacheStorageCache::KeysDidQueryCache, |
1268 weak_ptr_factory_.GetWeakPtr(), callback)); | 1272 weak_ptr_factory_.GetWeakPtr(), callback)); |
1269 } | 1273 } |
1270 | 1274 |
1271 void CacheStorageCache::KeysDidQueryCache( | 1275 void CacheStorageCache::KeysDidQueryCache( |
1272 const RequestsCallback& callback, | 1276 const RequestsCallback& callback, |
1273 CacheStorageError error, | 1277 CacheStorageError error, |
1274 std::unique_ptr<QueryCacheResults> query_cache_results) { | 1278 std::unique_ptr<QueryCacheResults> query_cache_results) { |
1275 if (error != CACHE_STORAGE_OK) { | 1279 if (error != CACHE_STORAGE_OK) { |
1276 callback.Run(error, std::unique_ptr<Requests>()); | 1280 callback.Run(error, std::unique_ptr<Requests>()); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1446 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
1443 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1447 return blob_storage_context_->AddFinishedBlob(&blob_data); |
1444 } | 1448 } |
1445 | 1449 |
1446 std::unique_ptr<CacheStorageCacheHandle> | 1450 std::unique_ptr<CacheStorageCacheHandle> |
1447 CacheStorageCache::CreateCacheHandle() { | 1451 CacheStorageCache::CreateCacheHandle() { |
1448 return cache_storage_->CreateCacheHandle(this); | 1452 return cache_storage_->CreateCacheHandle(this); |
1449 } | 1453 } |
1450 | 1454 |
1451 } // namespace content | 1455 } // namespace content |
OLD | NEW |