| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 weak_factory_.GetWeakPtr(), cache_name, callback)); | 699 weak_factory_.GetWeakPtr(), cache_name, callback)); |
| 700 } | 700 } |
| 701 | 701 |
| 702 void CacheStorage::CreateCacheDidCreateCache( | 702 void CacheStorage::CreateCacheDidCreateCache( |
| 703 const std::string& cache_name, | 703 const std::string& cache_name, |
| 704 const CacheAndErrorCallback& callback, | 704 const CacheAndErrorCallback& callback, |
| 705 scoped_refptr<CacheStorageCache> cache) { | 705 scoped_refptr<CacheStorageCache> cache) { |
| 706 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 706 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 707 | 707 |
| 708 UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.CreateCacheStorageResult", | 708 UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.CreateCacheStorageResult", |
| 709 cache != nullptr); | 709 static_cast<bool>(cache)); |
| 710 | 710 |
| 711 if (!cache.get()) { | 711 if (!cache.get()) { |
| 712 callback.Run(scoped_refptr<CacheStorageCache>(), | 712 callback.Run(scoped_refptr<CacheStorageCache>(), |
| 713 CACHE_STORAGE_ERROR_STORAGE); | 713 CACHE_STORAGE_ERROR_STORAGE); |
| 714 return; | 714 return; |
| 715 } | 715 } |
| 716 | 716 |
| 717 cache_map_.insert(std::make_pair(cache_name, cache->AsWeakPtr())); | 717 cache_map_.insert(std::make_pair(cache_name, cache->AsWeakPtr())); |
| 718 ordered_cache_names_.push_back(cache_name); | 718 ordered_cache_names_.push_back(cache_name); |
| 719 | 719 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 void CacheStorage::PendingSizeCallback(const SizeCallback& callback, | 1032 void CacheStorage::PendingSizeCallback(const SizeCallback& callback, |
| 1033 int64_t size) { | 1033 int64_t size) { |
| 1034 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); | 1034 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); |
| 1035 | 1035 |
| 1036 callback.Run(size); | 1036 callback.Run(size); |
| 1037 if (cache_storage) | 1037 if (cache_storage) |
| 1038 scheduler_->CompleteOperationAndRunNext(); | 1038 scheduler_->CompleteOperationAndRunNext(); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 } // namespace content | 1041 } // namespace content |
| OLD | NEW |