| 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.h" | 5 #include "content/browser/cache_storage/cache_storage.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 if (!cache) { | 773 if (!cache) { |
| 774 callback.Run(std::unique_ptr<CacheStorageCacheHandle>(), | 774 callback.Run(std::unique_ptr<CacheStorageCacheHandle>(), |
| 775 CACHE_STORAGE_ERROR_STORAGE); | 775 CACHE_STORAGE_ERROR_STORAGE); |
| 776 return; | 776 return; |
| 777 } | 777 } |
| 778 | 778 |
| 779 CacheStorageCache* cache_ptr = cache.get(); | 779 CacheStorageCache* cache_ptr = cache.get(); |
| 780 | 780 |
| 781 cache_map_.insert(std::make_pair(cache_name, std::move(cache))); | 781 cache_map_.insert(std::make_pair(cache_name, std::move(cache))); |
| 782 cache_index_->Insert( | 782 cache_index_->Insert( |
| 783 CacheStorageIndex::CacheMetadata(cache_name, cache_ptr->cache_size())); | 783 CacheStorageIndex::CacheMetadata(cache_name, cache_ptr->CacheSize())); |
| 784 | 784 |
| 785 cache_loader_->WriteIndex( | 785 cache_loader_->WriteIndex( |
| 786 *cache_index_, base::Bind(&CacheStorage::CreateCacheDidWriteIndex, | 786 *cache_index_, base::Bind(&CacheStorage::CreateCacheDidWriteIndex, |
| 787 weak_factory_.GetWeakPtr(), callback, | 787 weak_factory_.GetWeakPtr(), callback, |
| 788 base::Passed(CreateCacheHandle(cache_ptr)))); | 788 base::Passed(CreateCacheHandle(cache_ptr)))); |
| 789 | 789 |
| 790 cache_loader_->NotifyCacheCreated(cache_name, CreateCacheHandle(cache_ptr)); | 790 cache_loader_->NotifyCacheCreated(cache_name, CreateCacheHandle(cache_ptr)); |
| 791 } | 791 } |
| 792 | 792 |
| 793 void CacheStorage::CreateCacheDidWriteIndex( | 793 void CacheStorage::CreateCacheDidWriteIndex( |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 GetLoadedCache(cache_metadata.name); | 1097 GetLoadedCache(cache_metadata.name); |
| 1098 CacheStorageCache* cache = cache_handle->value(); | 1098 CacheStorageCache* cache = cache_handle->value(); |
| 1099 cache->Size(base::Bind(&CacheStorage::SizeRetrievedFromCache, | 1099 cache->Size(base::Bind(&CacheStorage::SizeRetrievedFromCache, |
| 1100 weak_factory_.GetWeakPtr(), | 1100 weak_factory_.GetWeakPtr(), |
| 1101 base::Passed(std::move(cache_handle)), | 1101 base::Passed(std::move(cache_handle)), |
| 1102 barrier_closure, accumulator_ptr)); | 1102 barrier_closure, accumulator_ptr)); |
| 1103 } | 1103 } |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 } // namespace content | 1106 } // namespace content |
| OLD | NEW |