Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 int request_id, | 148 int request_id, |
| 149 std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 149 std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
| 150 CacheStorageError error, | 150 CacheStorageError error, |
| 151 std::unique_ptr<CacheStorageCache::Requests> requests); | 151 std::unique_ptr<CacheStorageCache::Requests> requests); |
| 152 void OnCacheBatchCallback( | 152 void OnCacheBatchCallback( |
| 153 int thread_id, | 153 int thread_id, |
| 154 int request_id, | 154 int request_id, |
| 155 std::unique_ptr<CacheStorageCacheHandle> cache_handle, | 155 std::unique_ptr<CacheStorageCacheHandle> cache_handle, |
| 156 CacheStorageError error); | 156 CacheStorageError error); |
| 157 | 157 |
| 158 void StopPreservingCache(const CacheStorageCache* cache); | |
| 159 | |
| 158 // Hangs onto a cache handle. Returns a unique cache_id. Call | 160 // Hangs onto a cache handle. Returns a unique cache_id. Call |
| 159 // DropCacheReference when the reference is no longer needed. | 161 // DropCacheReference when the reference is no longer needed. |
| 160 CacheID StoreCacheReference( | 162 CacheID StoreCacheReference( |
| 161 std::unique_ptr<CacheStorageCacheHandle> cache_handle); | 163 std::unique_ptr<CacheStorageCacheHandle> cache_handle); |
| 162 void DropCacheReference(CacheID cache_id); | 164 void DropCacheReference(CacheID cache_id); |
| 163 | 165 |
| 164 // Stores blob handles while waiting for acknowledgement of receipt from the | 166 // Stores blob handles while waiting for acknowledgement of receipt from the |
| 165 // renderer. | 167 // renderer. |
| 166 void StoreBlobDataHandle(const storage::BlobDataHandle& blob_data_handle); | 168 void StoreBlobDataHandle(const storage::BlobDataHandle& blob_data_handle); |
| 167 void DropBlobDataHandle(const std::string& uuid); | 169 void DropBlobDataHandle(const std::string& uuid); |
| 168 | 170 |
| 171 // Store handles to recently opened caches for a short period in case they're | |
| 172 // used again in the near future. | |
| 173 std::map<const CacheStorageCache*, std::unique_ptr<CacheStorageCacheHandle>> | |
| 174 preserved_cache_handles_; | |
| 175 | |
| 169 IDToCacheMap id_to_cache_map_; | 176 IDToCacheMap id_to_cache_map_; |
| 170 CacheID next_cache_id_ = 0; | 177 CacheID next_cache_id_ = 0; |
| 171 | 178 |
| 172 UUIDToBlobDataHandleList blob_handle_store_; | 179 UUIDToBlobDataHandleList blob_handle_store_; |
| 173 | 180 |
| 174 scoped_refptr<CacheStorageContextImpl> context_; | 181 scoped_refptr<CacheStorageContextImpl> context_; |
| 175 | 182 |
| 183 base::WeakPtrFactory<CacheStorageDispatcherHost> weak_ptr_factory_; | |
|
nhiroki
2016/06/28 06:22:34
Is this usage of WeakPtrFactory safe?
According t
jkarlin
2016/06/28 11:20:14
Thanks, and good point. Fixed.
| |
| 184 | |
| 176 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcherHost); | 185 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcherHost); |
| 177 }; | 186 }; |
| 178 | 187 |
| 179 } // namespace content | 188 } // namespace content |
| 180 | 189 |
| 181 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ | 190 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_HOST_H_ |
| OLD | NEW |