Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/cache_storage/cache_storage.cc

Issue 2040173002: [CacheStorage] Clean up CacheStorageCache lifetimes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify and caught one more reference Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 41
42 const int kCachePreservationInSecs = 30; 42 const int kCachePreservationInSecs = 30;
43 43
44 std::string HexedHash(const std::string& value) { 44 std::string HexedHash(const std::string& value) {
45 std::string value_hash = base::SHA1HashString(value); 45 std::string value_hash = base::SHA1HashString(value);
46 std::string valued_hexed_hash = base::ToLowerASCII( 46 std::string valued_hexed_hash = base::ToLowerASCII(
47 base::HexEncode(value_hash.c_str(), value_hash.length())); 47 base::HexEncode(value_hash.c_str(), value_hash.length()));
48 return valued_hexed_hash; 48 return valued_hexed_hash;
49 } 49 }
50 50
51 void SizeRetrievedFromCache(const scoped_refptr<CacheStorageCache>& cache, 51 void SizeRetrievedFromCache(const base::Closure& closure,
52 const base::Closure& closure,
53 int64_t* accumulator, 52 int64_t* accumulator,
54 int64_t size) { 53 int64_t size) {
55 *accumulator += size; 54 *accumulator += size;
56 closure.Run(); 55 closure.Run();
57 } 56 }
58 57
59 void SizeRetrievedFromAllCaches(std::unique_ptr<int64_t> accumulator,
60 const CacheStorage::SizeCallback& callback) {
61 base::ThreadTaskRunnerHandle::Get()->PostTask(
62 FROM_HERE, base::Bind(callback, *accumulator));
63 }
64 58
65 } // namespace 59 } // namespace
66 60
67 const char CacheStorage::kIndexFileName[] = "index.txt"; 61 const char CacheStorage::kIndexFileName[] = "index.txt";
68 62
69 struct CacheStorage::CacheMatchResponse { 63 struct CacheStorage::CacheMatchResponse {
70 CacheMatchResponse() = default; 64 CacheMatchResponse() = default;
71 ~CacheMatchResponse() = default; 65 ~CacheMatchResponse() = default;
72 66
73 CacheStorageError error; 67 CacheStorageError error;
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 cache_loader_->PrepareNewCacheDestination( 691 cache_loader_->PrepareNewCacheDestination(
698 cache_name, base::Bind(&CacheStorage::CreateCacheDidCreateCache, 692 cache_name, base::Bind(&CacheStorage::CreateCacheDidCreateCache,
699 weak_factory_.GetWeakPtr(), cache_name, callback)); 693 weak_factory_.GetWeakPtr(), cache_name, callback));
700 } 694 }
701 695
702 void CacheStorage::CreateCacheDidCreateCache( 696 void CacheStorage::CreateCacheDidCreateCache(
703 const std::string& cache_name, 697 const std::string& cache_name,
704 const CacheAndErrorCallback& callback, 698 const CacheAndErrorCallback& callback,
705 scoped_refptr<CacheStorageCache> cache) { 699 scoped_refptr<CacheStorageCache> cache) {
706 DCHECK_CURRENTLY_ON(BrowserThread::IO); 700 DCHECK_CURRENTLY_ON(BrowserThread::IO);
707 701 DCHECK(!callback_cache_.get());
708 UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.CreateCacheStorageResult", 702 UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.CreateCacheStorageResult",
709 static_cast<bool>(cache)); 703 static_cast<bool>(cache));
710 704
711 if (!cache.get()) { 705 if (!cache.get()) {
712 callback.Run(scoped_refptr<CacheStorageCache>(), 706 callback.Run(scoped_refptr<CacheStorageCache>(),
713 CACHE_STORAGE_ERROR_STORAGE); 707 CACHE_STORAGE_ERROR_STORAGE);
714 return; 708 return;
715 } 709 }
716 710
717 cache_map_.insert(std::make_pair(cache_name, cache->AsWeakPtr())); 711 cache_map_.insert(std::make_pair(cache_name, cache->AsWeakPtr()));
718 ordered_cache_names_.push_back(cache_name); 712 ordered_cache_names_.push_back(cache_name);
719 713
720 TemporarilyPreserveCache(cache); 714 TemporarilyPreserveCache(cache);
715 callback_cache_ = std::move(cache);
721 716
722 cache_loader_->WriteIndex( 717 cache_loader_->WriteIndex(ordered_cache_names_,
723 ordered_cache_names_, 718 base::Bind(&CacheStorage::CreateCacheDidWriteIndex,
724 base::Bind(&CacheStorage::CreateCacheDidWriteIndex, 719 weak_factory_.GetWeakPtr(), callback));
725 weak_factory_.GetWeakPtr(), callback, std::move(cache)));
726 } 720 }
727 721
728 void CacheStorage::CreateCacheDidWriteIndex( 722 void CacheStorage::CreateCacheDidWriteIndex(
729 const CacheAndErrorCallback& callback, 723 const CacheAndErrorCallback& callback,
730 scoped_refptr<CacheStorageCache> cache,
731 bool success) { 724 bool success) {
732 DCHECK_CURRENTLY_ON(BrowserThread::IO); 725 DCHECK_CURRENTLY_ON(BrowserThread::IO);
733 DCHECK(cache.get()); 726 DCHECK(callback_cache_.get());
734 727
735 // TODO(jkarlin): Handle !success. 728 // TODO(jkarlin): Handle !success.
736 729 callback.Run(std::move(callback_cache_), CACHE_STORAGE_OK);
737 callback.Run(std::move(cache), CACHE_STORAGE_OK);
738 } 730 }
739 731
740 void CacheStorage::HasCacheImpl(const std::string& cache_name, 732 void CacheStorage::HasCacheImpl(const std::string& cache_name,
741 const BoolAndErrorCallback& callback) { 733 const BoolAndErrorCallback& callback) {
742 bool has_cache = ContainsKey(cache_map_, cache_name); 734 bool has_cache = ContainsKey(cache_map_, cache_name);
743 callback.Run(has_cache, CACHE_STORAGE_OK); 735 callback.Run(has_cache, CACHE_STORAGE_OK);
744 } 736 }
745 737
746 void CacheStorage::DeleteCacheImpl(const std::string& cache_name, 738 void CacheStorage::DeleteCacheImpl(const std::string& cache_name,
747 const BoolAndErrorCallback& callback) { 739 const BoolAndErrorCallback& callback) {
740 DCHECK(!callback_cache_.get());
748 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name); 741 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name);
749 if (!cache.get()) { 742 if (!cache.get()) {
750 base::ThreadTaskRunnerHandle::Get()->PostTask( 743 base::ThreadTaskRunnerHandle::Get()->PostTask(
751 FROM_HERE, base::Bind(callback, false, CACHE_STORAGE_ERROR_NOT_FOUND)); 744 FROM_HERE, base::Bind(callback, false, CACHE_STORAGE_ERROR_NOT_FOUND));
752 return; 745 return;
753 } 746 }
754 747
755 CacheMap::iterator map_iter = cache_map_.find(cache_name); 748 CacheMap::iterator map_iter = cache_map_.find(cache_name);
756 cache_map_.erase(map_iter); 749 cache_map_.erase(map_iter);
757 750
758 // Delete the name from ordered_cache_names_. 751 // Delete the name from ordered_cache_names_.
759 StringVector::iterator iter = std::find( 752 StringVector::iterator iter = std::find(
760 ordered_cache_names_.begin(), ordered_cache_names_.end(), cache_name); 753 ordered_cache_names_.begin(), ordered_cache_names_.end(), cache_name);
761 DCHECK(iter != ordered_cache_names_.end()); 754 DCHECK(iter != ordered_cache_names_.end());
762 ordered_cache_names_.erase(iter); 755 ordered_cache_names_.erase(iter);
763 756
764 cache->GetSizeThenClose(base::Bind(&CacheStorage::DeleteCacheDidClose, 757 cache->GetSizeThenClose(base::Bind(&CacheStorage::DeleteCacheDidClose,
765 weak_factory_.GetWeakPtr(), cache_name, 758 weak_factory_.GetWeakPtr(), cache_name,
766 callback, ordered_cache_names_, cache)); 759 callback, ordered_cache_names_));
760 callback_cache_ = std::move(cache);
767 } 761 }
768 762
769 void CacheStorage::DeleteCacheDidClose(const std::string& cache_name, 763 void CacheStorage::DeleteCacheDidClose(const std::string& cache_name,
770 const BoolAndErrorCallback& callback, 764 const BoolAndErrorCallback& callback,
771 const StringVector& ordered_cache_names, 765 const StringVector& ordered_cache_names,
772 scoped_refptr<CacheStorageCache> cache,
773 int64_t cache_size) { 766 int64_t cache_size) {
767 callback_cache_ = nullptr;
774 cache_loader_->WriteIndex( 768 cache_loader_->WriteIndex(
775 ordered_cache_names, 769 ordered_cache_names,
776 base::Bind(&CacheStorage::DeleteCacheDidWriteIndex, 770 base::Bind(&CacheStorage::DeleteCacheDidWriteIndex,
777 weak_factory_.GetWeakPtr(), cache_name, callback, cache_size)); 771 weak_factory_.GetWeakPtr(), cache_name, callback, cache_size));
778 } 772 }
779 773
780 void CacheStorage::DeleteCacheDidWriteIndex( 774 void CacheStorage::DeleteCacheDidWriteIndex(
781 const std::string& cache_name, 775 const std::string& cache_name,
782 const BoolAndErrorCallback& callback, 776 const BoolAndErrorCallback& callback,
783 int cache_size, 777 int cache_size,
(...skipping 18 matching lines...) Expand all
802 796
803 void CacheStorage::EnumerateCachesImpl( 797 void CacheStorage::EnumerateCachesImpl(
804 const StringsAndErrorCallback& callback) { 798 const StringsAndErrorCallback& callback) {
805 callback.Run(ordered_cache_names_, CACHE_STORAGE_OK); 799 callback.Run(ordered_cache_names_, CACHE_STORAGE_OK);
806 } 800 }
807 801
808 void CacheStorage::MatchCacheImpl( 802 void CacheStorage::MatchCacheImpl(
809 const std::string& cache_name, 803 const std::string& cache_name,
810 std::unique_ptr<ServiceWorkerFetchRequest> request, 804 std::unique_ptr<ServiceWorkerFetchRequest> request,
811 const CacheStorageCache::ResponseCallback& callback) { 805 const CacheStorageCache::ResponseCallback& callback) {
806 DCHECK(!callback_cache_.get());
812 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name); 807 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name);
813 808
814 if (!cache.get()) { 809 if (!cache.get()) {
815 callback.Run(CACHE_STORAGE_ERROR_CACHE_NAME_NOT_FOUND, 810 callback.Run(CACHE_STORAGE_ERROR_CACHE_NAME_NOT_FOUND,
816 std::unique_ptr<ServiceWorkerResponse>(), 811 std::unique_ptr<ServiceWorkerResponse>(),
817 std::unique_ptr<storage::BlobDataHandle>()); 812 std::unique_ptr<storage::BlobDataHandle>());
818 return; 813 return;
819 } 814 }
820 815
821 // Pass the cache along to the callback to keep the cache open until match is
822 // done.
823 cache->Match(std::move(request), 816 cache->Match(std::move(request),
824 base::Bind(&CacheStorage::MatchCacheDidMatch, 817 base::Bind(&CacheStorage::MatchCacheDidMatch,
825 weak_factory_.GetWeakPtr(), cache, callback)); 818 weak_factory_.GetWeakPtr(), callback));
819 callback_cache_ = std::move(cache);
826 } 820 }
827 821
828 void CacheStorage::MatchCacheDidMatch( 822 void CacheStorage::MatchCacheDidMatch(
829 scoped_refptr<CacheStorageCache> cache,
830 const CacheStorageCache::ResponseCallback& callback, 823 const CacheStorageCache::ResponseCallback& callback,
831 CacheStorageError error, 824 CacheStorageError error,
832 std::unique_ptr<ServiceWorkerResponse> response, 825 std::unique_ptr<ServiceWorkerResponse> response,
833 std::unique_ptr<storage::BlobDataHandle> handle) { 826 std::unique_ptr<storage::BlobDataHandle> handle) {
827 callback_cache_ = nullptr;
834 callback.Run(error, std::move(response), std::move(handle)); 828 callback.Run(error, std::move(response), std::move(handle));
835 } 829 }
836 830
837 void CacheStorage::MatchAllCachesImpl( 831 void CacheStorage::MatchAllCachesImpl(
838 std::unique_ptr<ServiceWorkerFetchRequest> request, 832 std::unique_ptr<ServiceWorkerFetchRequest> request,
839 const CacheStorageCache::ResponseCallback& callback) { 833 const CacheStorageCache::ResponseCallback& callback) {
834 DCHECK(callback_caches_.empty());
840 std::vector<CacheMatchResponse>* match_responses = 835 std::vector<CacheMatchResponse>* match_responses =
841 new std::vector<CacheMatchResponse>(ordered_cache_names_.size()); 836 new std::vector<CacheMatchResponse>(ordered_cache_names_.size());
842 837
843 base::Closure barrier_closure = base::BarrierClosure( 838 base::Closure barrier_closure = base::BarrierClosure(
844 ordered_cache_names_.size(), 839 ordered_cache_names_.size(),
845 base::Bind(&CacheStorage::MatchAllCachesDidMatchAll, 840 base::Bind(&CacheStorage::MatchAllCachesDidMatchAll,
846 weak_factory_.GetWeakPtr(), 841 weak_factory_.GetWeakPtr(),
847 base::Passed(base::WrapUnique(match_responses)), callback)); 842 base::Passed(base::WrapUnique(match_responses)), callback));
848 843
844 callback_caches_.resize(ordered_cache_names_.size());
849 for (size_t i = 0, max = ordered_cache_names_.size(); i < max; ++i) { 845 for (size_t i = 0, max = ordered_cache_names_.size(); i < max; ++i) {
850 scoped_refptr<CacheStorageCache> cache = 846 scoped_refptr<CacheStorageCache> cache =
851 GetLoadedCache(ordered_cache_names_[i]); 847 GetLoadedCache(ordered_cache_names_[i]);
852 DCHECK(cache.get()); 848 DCHECK(cache.get());
853 849
854 cache->Match(base::WrapUnique(new ServiceWorkerFetchRequest(*request)), 850 cache->Match(base::WrapUnique(new ServiceWorkerFetchRequest(*request)),
855 base::Bind(&CacheStorage::MatchAllCachesDidMatch, 851 base::Bind(&CacheStorage::MatchAllCachesDidMatch,
856 weak_factory_.GetWeakPtr(), cache, 852 weak_factory_.GetWeakPtr(), &match_responses->at(i),
857 &match_responses->at(i), barrier_closure)); 853 barrier_closure));
854 callback_caches_.push_back(std::move(cache));
858 } 855 }
859 } 856 }
860 857
861 void CacheStorage::MatchAllCachesDidMatch( 858 void CacheStorage::MatchAllCachesDidMatch(
862 scoped_refptr<CacheStorageCache> cache,
863 CacheMatchResponse* out_match_response, 859 CacheMatchResponse* out_match_response,
864 const base::Closure& barrier_closure, 860 const base::Closure& barrier_closure,
865 CacheStorageError error, 861 CacheStorageError error,
866 std::unique_ptr<ServiceWorkerResponse> service_worker_response, 862 std::unique_ptr<ServiceWorkerResponse> service_worker_response,
867 std::unique_ptr<storage::BlobDataHandle> handle) { 863 std::unique_ptr<storage::BlobDataHandle> handle) {
868 out_match_response->error = error; 864 out_match_response->error = error;
869 out_match_response->service_worker_response = 865 out_match_response->service_worker_response =
870 std::move(service_worker_response); 866 std::move(service_worker_response);
871 out_match_response->blob_data_handle = std::move(handle); 867 out_match_response->blob_data_handle = std::move(handle);
872 barrier_closure.Run(); 868 barrier_closure.Run();
873 } 869 }
874 870
875 void CacheStorage::MatchAllCachesDidMatchAll( 871 void CacheStorage::MatchAllCachesDidMatchAll(
876 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses, 872 std::unique_ptr<std::vector<CacheMatchResponse>> match_responses,
877 const CacheStorageCache::ResponseCallback& callback) { 873 const CacheStorageCache::ResponseCallback& callback) {
874 callback_caches_.clear();
878 for (CacheMatchResponse& match_response : *match_responses) { 875 for (CacheMatchResponse& match_response : *match_responses) {
879 if (match_response.error == CACHE_STORAGE_ERROR_NOT_FOUND) 876 if (match_response.error == CACHE_STORAGE_ERROR_NOT_FOUND)
880 continue; 877 continue;
881 callback.Run(match_response.error, 878 callback.Run(match_response.error,
882 std::move(match_response.service_worker_response), 879 std::move(match_response.service_worker_response),
883 std::move(match_response.blob_data_handle)); 880 std::move(match_response.blob_data_handle));
884 return; 881 return;
885 } 882 }
886 callback.Run(CACHE_STORAGE_ERROR_NOT_FOUND, 883 callback.Run(CACHE_STORAGE_ERROR_NOT_FOUND,
887 std::unique_ptr<ServiceWorkerResponse>(), 884 std::unique_ptr<ServiceWorkerResponse>(),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 void CacheStorage::RemovePreservedCache(const CacheStorageCache* cache) { 931 void CacheStorage::RemovePreservedCache(const CacheStorageCache* cache) {
935 DCHECK_CURRENTLY_ON(BrowserThread::IO); 932 DCHECK_CURRENTLY_ON(BrowserThread::IO);
936 DCHECK(ContainsKey(preserved_caches_, cache)); 933 DCHECK(ContainsKey(preserved_caches_, cache));
937 934
938 preserved_caches_.erase(cache); 935 preserved_caches_.erase(cache);
939 } 936 }
940 937
941 void CacheStorage::GetSizeThenCloseAllCachesImpl(const SizeCallback& callback) { 938 void CacheStorage::GetSizeThenCloseAllCachesImpl(const SizeCallback& callback) {
942 DCHECK_CURRENTLY_ON(BrowserThread::IO); 939 DCHECK_CURRENTLY_ON(BrowserThread::IO);
943 DCHECK(initialized_); 940 DCHECK(initialized_);
941 DCHECK(callback_caches_.empty());
944 942
945 std::unique_ptr<int64_t> accumulator(new int64_t(0)); 943 std::unique_ptr<int64_t> accumulator(new int64_t(0));
946 int64_t* accumulator_ptr = accumulator.get(); 944 int64_t* accumulator_ptr = accumulator.get();
947 945
948 base::Closure barrier_closure = base::BarrierClosure( 946 base::Closure barrier_closure = base::BarrierClosure(
949 ordered_cache_names_.size(), 947 ordered_cache_names_.size(),
950 base::Bind(&SizeRetrievedFromAllCaches, 948 base::Bind(&CacheStorage::SizeRetrievedFromAllCaches,
949 weak_factory_.GetWeakPtr(),
951 base::Passed(std::move(accumulator)), callback)); 950 base::Passed(std::move(accumulator)), callback));
952 951
952 callback_caches_.resize(ordered_cache_names_.size());
953 for (const std::string& cache_name : ordered_cache_names_) { 953 for (const std::string& cache_name : ordered_cache_names_) {
954 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name); 954 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name);
955 cache->GetSizeThenClose(base::Bind(&SizeRetrievedFromCache, cache, 955 cache->GetSizeThenClose(
956 barrier_closure, accumulator_ptr)); 956 base::Bind(&SizeRetrievedFromCache, barrier_closure, accumulator_ptr));
957 callback_caches_.push_back(std::move(cache));
957 } 958 }
958 } 959 }
959 960
960 void CacheStorage::SizeImpl(const SizeCallback& callback) { 961 void CacheStorage::SizeImpl(const SizeCallback& callback) {
961 DCHECK_CURRENTLY_ON(BrowserThread::IO); 962 DCHECK_CURRENTLY_ON(BrowserThread::IO);
962 DCHECK(initialized_); 963 DCHECK(initialized_);
964 DCHECK(callback_caches_.empty());
963 965
964 std::unique_ptr<int64_t> accumulator(new int64_t(0)); 966 std::unique_ptr<int64_t> accumulator(new int64_t(0));
965 int64_t* accumulator_ptr = accumulator.get(); 967 int64_t* accumulator_ptr = accumulator.get();
966 968
967 base::Closure barrier_closure = base::BarrierClosure( 969 base::Closure barrier_closure = base::BarrierClosure(
968 ordered_cache_names_.size(), 970 ordered_cache_names_.size(),
969 base::Bind(&SizeRetrievedFromAllCaches, 971 base::Bind(&CacheStorage::SizeRetrievedFromAllCaches,
972 weak_factory_.GetWeakPtr(),
970 base::Passed(std::move(accumulator)), callback)); 973 base::Passed(std::move(accumulator)), callback));
971 974
975 callback_caches_.resize(ordered_cache_names_.size());
972 for (const std::string& cache_name : ordered_cache_names_) { 976 for (const std::string& cache_name : ordered_cache_names_) {
973 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name); 977 scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name);
974 cache->Size(base::Bind(&SizeRetrievedFromCache, cache, barrier_closure, 978 cache->Size(
975 accumulator_ptr)); 979 base::Bind(&SizeRetrievedFromCache, barrier_closure, accumulator_ptr));
980 callback_caches_.push_back(std::move(cache));
976 } 981 }
977 } 982 }
978 983
984 void CacheStorage::SizeRetrievedFromAllCaches(
985 std::unique_ptr<int64_t> accumulator,
986 const CacheStorage::SizeCallback& callback) {
987 callback_caches_.clear();
988 base::ThreadTaskRunnerHandle::Get()->PostTask(
989 FROM_HERE, base::Bind(callback, *accumulator));
990 }
991
979 void CacheStorage::PendingClosure(const base::Closure& callback) { 992 void CacheStorage::PendingClosure(const base::Closure& callback) {
980 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); 993 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr();
981 994
982 callback.Run(); 995 callback.Run();
983 if (cache_storage) 996 if (cache_storage)
984 scheduler_->CompleteOperationAndRunNext(); 997 scheduler_->CompleteOperationAndRunNext();
985 } 998 }
986 999
987 void CacheStorage::PendingBoolAndErrorCallback( 1000 void CacheStorage::PendingBoolAndErrorCallback(
988 const BoolAndErrorCallback& callback, 1001 const BoolAndErrorCallback& callback,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 void CacheStorage::PendingSizeCallback(const SizeCallback& callback, 1045 void CacheStorage::PendingSizeCallback(const SizeCallback& callback,
1033 int64_t size) { 1046 int64_t size) {
1034 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); 1047 base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr();
1035 1048
1036 callback.Run(size); 1049 callback.Run(size);
1037 if (cache_storage) 1050 if (cache_storage)
1038 scheduler_->CompleteOperationAndRunNext(); 1051 scheduler_->CompleteOperationAndRunNext();
1039 } 1052 }
1040 1053
1041 } // namespace content 1054 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage.h ('k') | content/browser/cache_storage/cache_storage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698