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 <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 DCHECK_EQ(CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT, operation.operation_type); | 1012 DCHECK_EQ(CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT, operation.operation_type); |
1013 | 1013 |
1014 std::unique_ptr<ServiceWorkerFetchRequest> request( | 1014 std::unique_ptr<ServiceWorkerFetchRequest> request( |
1015 new ServiceWorkerFetchRequest( | 1015 new ServiceWorkerFetchRequest( |
1016 operation.request.url, operation.request.method, | 1016 operation.request.url, operation.request.method, |
1017 operation.request.headers, operation.request.referrer, | 1017 operation.request.headers, operation.request.referrer, |
1018 operation.request.is_reload)); | 1018 operation.request.is_reload)); |
1019 | 1019 |
1020 // We don't support streaming for cache. | 1020 // We don't support streaming for cache. |
1021 DCHECK(operation.response.stream_url.is_empty()); | 1021 DCHECK(operation.response.stream_url.is_empty()); |
1022 // We don't support the body of redirect response. | |
1023 DCHECK(!(operation.response.response_type == | |
1024 blink::kWebServiceWorkerResponseTypeOpaqueRedirect && | |
1025 operation.response.blob_size)); | |
1026 | 1022 |
1027 std::unique_ptr<ServiceWorkerResponse> response = | 1023 std::unique_ptr<ServiceWorkerResponse> response = |
1028 base::MakeUnique<ServiceWorkerResponse>(operation.response); | 1024 base::MakeUnique<ServiceWorkerResponse>(operation.response); |
1029 std::unique_ptr<storage::BlobDataHandle> blob_data_handle; | 1025 std::unique_ptr<storage::BlobDataHandle> blob_data_handle; |
1030 | 1026 |
1031 if (!response->blob_uuid.empty()) { | 1027 if (!response->blob_uuid.empty()) { |
1032 if (!blob_storage_context_) { | 1028 if (!blob_storage_context_) { |
1033 callback.Run(CACHE_STORAGE_ERROR_STORAGE); | 1029 callback.Run(CACHE_STORAGE_ERROR_STORAGE); |
1034 return; | 1030 return; |
1035 } | 1031 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1487 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
1492 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1488 return blob_storage_context_->AddFinishedBlob(&blob_data); |
1493 } | 1489 } |
1494 | 1490 |
1495 std::unique_ptr<CacheStorageCacheHandle> | 1491 std::unique_ptr<CacheStorageCacheHandle> |
1496 CacheStorageCache::CreateCacheHandle() { | 1492 CacheStorageCache::CreateCacheHandle() { |
1497 return cache_storage_->CreateCacheHandle(this); | 1493 return cache_storage_->CreateCacheHandle(this); |
1498 } | 1494 } |
1499 | 1495 |
1500 } // namespace content | 1496 } // namespace content |
OLD | NEW |