| 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 #ifndef CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 std::unique_ptr<blink::WebServiceWorkerCache::CacheBatchCallbacks> | 159 std::unique_ptr<blink::WebServiceWorkerCache::CacheBatchCallbacks> |
| 160 callbacks, | 160 callbacks, |
| 161 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& | 161 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& |
| 162 batch_operations); | 162 batch_operations); |
| 163 | 163 |
| 164 void OnWebCacheDestruction(int cache_id); | 164 void OnWebCacheDestruction(int cache_id); |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 class WebCache; | 167 class WebCache; |
| 168 | 168 |
| 169 typedef IDMap<blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks, | 169 typedef IDMap<std::unique_ptr< |
| 170 IDMapOwnPointer> CallbacksMap; | 170 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks>> |
| 171 typedef IDMap< | 171 CallbacksMap; |
| 172 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks, | 172 typedef IDMap<std::unique_ptr< |
| 173 IDMapOwnPointer> WithCacheCallbacksMap; | 173 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks>> |
| 174 typedef IDMap<blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks, | 174 WithCacheCallbacksMap; |
| 175 IDMapOwnPointer> KeysCallbacksMap; | 175 typedef IDMap<std::unique_ptr< |
| 176 typedef IDMap<blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks, | 176 blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks>> |
| 177 IDMapOwnPointer> StorageMatchCallbacksMap; | 177 KeysCallbacksMap; |
| 178 typedef IDMap<std::unique_ptr< |
| 179 blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks>> |
| 180 StorageMatchCallbacksMap; |
| 178 | 181 |
| 179 typedef base::hash_map<int32_t, base::TimeTicks> TimeMap; | 182 typedef base::hash_map<int32_t, base::TimeTicks> TimeMap; |
| 180 | 183 |
| 181 typedef IDMap<blink::WebServiceWorkerCache::CacheMatchCallbacks, | 184 typedef IDMap< |
| 182 IDMapOwnPointer> MatchCallbacksMap; | 185 std::unique_ptr<blink::WebServiceWorkerCache::CacheMatchCallbacks>> |
| 183 typedef IDMap<blink::WebServiceWorkerCache::CacheWithResponsesCallbacks, | 186 MatchCallbacksMap; |
| 184 IDMapOwnPointer> WithResponsesCallbacksMap; | 187 typedef IDMap<std::unique_ptr< |
| 185 typedef IDMap<blink::WebServiceWorkerCache::CacheWithRequestsCallbacks, | 188 blink::WebServiceWorkerCache::CacheWithResponsesCallbacks>> |
| 186 IDMapOwnPointer> WithRequestsCallbacksMap; | 189 WithResponsesCallbacksMap; |
| 190 typedef IDMap< |
| 191 std::unique_ptr<blink::WebServiceWorkerCache::CacheWithRequestsCallbacks>> |
| 192 WithRequestsCallbacksMap; |
| 187 using BatchCallbacksMap = | 193 using BatchCallbacksMap = |
| 188 IDMap<blink::WebServiceWorkerCache::CacheBatchCallbacks, IDMapOwnPointer>; | 194 IDMap<std::unique_ptr<blink::WebServiceWorkerCache::CacheBatchCallbacks>>; |
| 189 | 195 |
| 190 static int32_t CurrentWorkerId() { return WorkerThread::GetCurrentId(); } | 196 static int32_t CurrentWorkerId() { return WorkerThread::GetCurrentId(); } |
| 191 | 197 |
| 192 void PopulateWebResponseFromResponse( | 198 void PopulateWebResponseFromResponse( |
| 193 const ServiceWorkerResponse& response, | 199 const ServiceWorkerResponse& response, |
| 194 blink::WebServiceWorkerResponse* web_response); | 200 blink::WebServiceWorkerResponse* web_response); |
| 195 | 201 |
| 196 blink::WebVector<blink::WebServiceWorkerResponse> WebResponsesFromResponses( | 202 blink::WebVector<blink::WebServiceWorkerResponse> WebResponsesFromResponses( |
| 197 const std::vector<ServiceWorkerResponse>& responses); | 203 const std::vector<ServiceWorkerResponse>& responses); |
| 198 | 204 |
| 199 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 205 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 200 | 206 |
| 201 CallbacksMap has_callbacks_; | 207 CallbacksMap has_callbacks_; |
| 202 WithCacheCallbacksMap open_callbacks_; | 208 WithCacheCallbacksMap open_callbacks_; |
| 203 CallbacksMap delete_callbacks_; | 209 CallbacksMap delete_callbacks_; |
| 204 KeysCallbacksMap keys_callbacks_; | 210 KeysCallbacksMap keys_callbacks_; |
| 205 StorageMatchCallbacksMap match_callbacks_; | 211 StorageMatchCallbacksMap match_callbacks_; |
| 206 | 212 |
| 207 TimeMap has_times_; | 213 TimeMap has_times_; |
| 208 TimeMap open_times_; | 214 TimeMap open_times_; |
| 209 TimeMap delete_times_; | 215 TimeMap delete_times_; |
| 210 TimeMap keys_times_; | 216 TimeMap keys_times_; |
| 211 TimeMap match_times_; | 217 TimeMap match_times_; |
| 212 | 218 |
| 213 // The individual caches created under this CacheStorage object. | 219 // The individual caches created under this CacheStorage object. |
| 214 IDMap<WebCache, IDMapExternalPointer> web_caches_; | 220 IDMap<WebCache*> web_caches_; |
| 215 | 221 |
| 216 // These ID maps are held in the CacheStorage object rather than the Cache | 222 // These ID maps are held in the CacheStorage object rather than the Cache |
| 217 // object to ensure that the IDs are unique. | 223 // object to ensure that the IDs are unique. |
| 218 MatchCallbacksMap cache_match_callbacks_; | 224 MatchCallbacksMap cache_match_callbacks_; |
| 219 WithResponsesCallbacksMap cache_match_all_callbacks_; | 225 WithResponsesCallbacksMap cache_match_all_callbacks_; |
| 220 WithRequestsCallbacksMap cache_keys_callbacks_; | 226 WithRequestsCallbacksMap cache_keys_callbacks_; |
| 221 BatchCallbacksMap cache_batch_callbacks_; | 227 BatchCallbacksMap cache_batch_callbacks_; |
| 222 | 228 |
| 223 TimeMap cache_match_times_; | 229 TimeMap cache_match_times_; |
| 224 TimeMap cache_match_all_times_; | 230 TimeMap cache_match_all_times_; |
| 225 TimeMap cache_keys_times_; | 231 TimeMap cache_keys_times_; |
| 226 TimeMap cache_batch_times_; | 232 TimeMap cache_batch_times_; |
| 227 | 233 |
| 228 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; | 234 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; |
| 229 | 235 |
| 230 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); | 236 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); |
| 231 }; | 237 }; |
| 232 | 238 |
| 233 } // namespace content | 239 } // namespace content |
| 234 | 240 |
| 235 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ | 241 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ |
| OLD | NEW |