| 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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 UpdateCacheSize(); | 1124 UpdateCacheSize(); |
| 1125 put_context->callback.Run(CACHE_STORAGE_OK); | 1125 put_context->callback.Run(CACHE_STORAGE_OK); |
| 1126 return; | 1126 return; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 DCHECK(put_context->blob_data_handle); | 1129 DCHECK(put_context->blob_data_handle); |
| 1130 | 1130 |
| 1131 disk_cache::ScopedEntryPtr entry(std::move(put_context->cache_entry)); | 1131 disk_cache::ScopedEntryPtr entry(std::move(put_context->cache_entry)); |
| 1132 put_context->cache_entry = NULL; | 1132 put_context->cache_entry = NULL; |
| 1133 | 1133 |
| 1134 CacheStorageBlobToDiskCache* blob_to_cache = | 1134 auto blob_to_cache = base::MakeUnique<CacheStorageBlobToDiskCache>(); |
| 1135 new CacheStorageBlobToDiskCache(); | 1135 CacheStorageBlobToDiskCache* blob_to_cache_raw = blob_to_cache.get(); |
| 1136 BlobToDiskCacheIDMap::KeyType blob_to_cache_key = | 1136 BlobToDiskCacheIDMap::KeyType blob_to_cache_key = |
| 1137 active_blob_to_disk_cache_writers_.Add(blob_to_cache); | 1137 active_blob_to_disk_cache_writers_.Add(std::move(blob_to_cache)); |
| 1138 | 1138 |
| 1139 std::unique_ptr<storage::BlobDataHandle> blob_data_handle = | 1139 std::unique_ptr<storage::BlobDataHandle> blob_data_handle = |
| 1140 std::move(put_context->blob_data_handle); | 1140 std::move(put_context->blob_data_handle); |
| 1141 | 1141 |
| 1142 blob_to_cache->StreamBlobToCache( | 1142 blob_to_cache_raw->StreamBlobToCache( |
| 1143 std::move(entry), INDEX_RESPONSE_BODY, request_context_getter_.get(), | 1143 std::move(entry), INDEX_RESPONSE_BODY, request_context_getter_.get(), |
| 1144 std::move(blob_data_handle), | 1144 std::move(blob_data_handle), |
| 1145 base::Bind(&CacheStorageCache::PutDidWriteBlobToCache, | 1145 base::Bind(&CacheStorageCache::PutDidWriteBlobToCache, |
| 1146 weak_ptr_factory_.GetWeakPtr(), | 1146 weak_ptr_factory_.GetWeakPtr(), |
| 1147 base::Passed(std::move(put_context)), blob_to_cache_key)); | 1147 base::Passed(std::move(put_context)), blob_to_cache_key)); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 void CacheStorageCache::PutDidWriteBlobToCache( | 1150 void CacheStorageCache::PutDidWriteBlobToCache( |
| 1151 std::unique_ptr<PutContext> put_context, | 1151 std::unique_ptr<PutContext> put_context, |
| 1152 BlobToDiskCacheIDMap::KeyType blob_to_cache_key, | 1152 BlobToDiskCacheIDMap::KeyType blob_to_cache_key, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1443 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
| 1444 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1444 return blob_storage_context_->AddFinishedBlob(&blob_data); |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 std::unique_ptr<CacheStorageCacheHandle> | 1447 std::unique_ptr<CacheStorageCacheHandle> |
| 1448 CacheStorageCache::CreateCacheHandle() { | 1448 CacheStorageCache::CreateCacheHandle() { |
| 1449 return cache_storage_->CreateCacheHandle(this); | 1449 return cache_storage_->CreateCacheHandle(this); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 } // namespace content | 1452 } // namespace content |
| OLD | NEW |