| 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 <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 17 #include "content/public/child/worker_thread.h" | 18 #include "content/public/child/worker_thread.h" |
| 18 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 19 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" | 20 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void OnCacheKeysError(int thread_id, | 99 void OnCacheKeysError(int thread_id, |
| 99 int request_id, | 100 int request_id, |
| 100 blink::WebServiceWorkerCacheError reason); | 101 blink::WebServiceWorkerCacheError reason); |
| 101 void OnCacheBatchError(int thread_id, | 102 void OnCacheBatchError(int thread_id, |
| 102 int request_id, | 103 int request_id, |
| 103 blink::WebServiceWorkerCacheError reason); | 104 blink::WebServiceWorkerCacheError reason); |
| 104 | 105 |
| 105 // TODO(jsbell): These are only called by WebServiceWorkerCacheStorageImpl | 106 // TODO(jsbell): These are only called by WebServiceWorkerCacheStorageImpl |
| 106 // and should be renamed to match Chromium conventions. crbug.com/439389 | 107 // and should be renamed to match Chromium conventions. crbug.com/439389 |
| 107 void dispatchHas( | 108 void dispatchHas( |
| 108 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, | 109 std::unique_ptr< |
| 110 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks> callbacks, |
| 109 const url::Origin& origin, | 111 const url::Origin& origin, |
| 110 const blink::WebString& cacheName); | 112 const blink::WebString& cacheName); |
| 111 void dispatchOpen( | 113 void dispatchOpen( |
| 112 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks* | 114 std::unique_ptr< |
| 115 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks> |
| 113 callbacks, | 116 callbacks, |
| 114 const url::Origin& origin, | 117 const url::Origin& origin, |
| 115 const blink::WebString& cacheName); | 118 const blink::WebString& cacheName); |
| 116 void dispatchDelete( | 119 void dispatchDelete( |
| 117 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, | 120 std::unique_ptr< |
| 121 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks> callbacks, |
| 118 const url::Origin& origin, | 122 const url::Origin& origin, |
| 119 const blink::WebString& cacheName); | 123 const blink::WebString& cacheName); |
| 120 void dispatchKeys( | 124 void dispatchKeys( |
| 121 blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks* callbacks, | 125 std::unique_ptr< |
| 126 blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks> |
| 127 callbacks, |
| 122 const url::Origin& origin); | 128 const url::Origin& origin); |
| 123 void dispatchMatch( | 129 void dispatchMatch( |
| 124 blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks* | 130 std::unique_ptr< |
| 131 blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks> |
| 125 callbacks, | 132 callbacks, |
| 126 const url::Origin& origin, | 133 const url::Origin& origin, |
| 127 const blink::WebServiceWorkerRequest& request, | 134 const blink::WebServiceWorkerRequest& request, |
| 128 const blink::WebServiceWorkerCache::QueryParams& query_params); | 135 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| 129 | 136 |
| 130 // These methods are used by WebCache to forward events to the browser | 137 // These methods are used by WebCache to forward events to the browser |
| 131 // process. | 138 // process. |
| 132 void dispatchMatchForCache( | 139 void dispatchMatchForCache( |
| 133 int cache_id, | 140 int cache_id, |
| 134 blink::WebServiceWorkerCache::CacheMatchCallbacks* callbacks, | 141 std::unique_ptr<blink::WebServiceWorkerCache::CacheMatchCallbacks> |
| 142 callbacks, |
| 135 const blink::WebServiceWorkerRequest& request, | 143 const blink::WebServiceWorkerRequest& request, |
| 136 const blink::WebServiceWorkerCache::QueryParams& query_params); | 144 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| 137 void dispatchMatchAllForCache( | 145 void dispatchMatchAllForCache( |
| 138 int cache_id, | 146 int cache_id, |
| 139 blink::WebServiceWorkerCache::CacheWithResponsesCallbacks* callbacks, | 147 std::unique_ptr<blink::WebServiceWorkerCache::CacheWithResponsesCallbacks> |
| 148 callbacks, |
| 140 const blink::WebServiceWorkerRequest& request, | 149 const blink::WebServiceWorkerRequest& request, |
| 141 const blink::WebServiceWorkerCache::QueryParams& query_params); | 150 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| 142 void dispatchKeysForCache( | 151 void dispatchKeysForCache( |
| 143 int cache_id, | 152 int cache_id, |
| 144 blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks, | 153 std::unique_ptr<blink::WebServiceWorkerCache::CacheWithRequestsCallbacks> |
| 154 callbacks, |
| 145 const blink::WebServiceWorkerRequest& request, | 155 const blink::WebServiceWorkerRequest& request, |
| 146 const blink::WebServiceWorkerCache::QueryParams& query_params); | 156 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| 147 void dispatchBatchForCache( | 157 void dispatchBatchForCache( |
| 148 int cache_id, | 158 int cache_id, |
| 149 blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks, | 159 std::unique_ptr<blink::WebServiceWorkerCache::CacheBatchCallbacks> |
| 160 callbacks, |
| 150 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& | 161 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& |
| 151 batch_operations); | 162 batch_operations); |
| 152 | 163 |
| 153 void OnWebCacheDestruction(int cache_id); | 164 void OnWebCacheDestruction(int cache_id); |
| 154 | 165 |
| 155 private: | 166 private: |
| 156 class WebCache; | 167 class WebCache; |
| 157 | 168 |
| 158 typedef IDMap<blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks, | 169 typedef IDMap<blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks, |
| 159 IDMapOwnPointer> CallbacksMap; | 170 IDMapOwnPointer> CallbacksMap; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 TimeMap cache_batch_times_; | 226 TimeMap cache_batch_times_; |
| 216 | 227 |
| 217 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; | 228 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; |
| 218 | 229 |
| 219 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); | 230 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); |
| 220 }; | 231 }; |
| 221 | 232 |
| 222 } // namespace content | 233 } // namespace content |
| 223 | 234 |
| 224 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ | 235 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ |
| OLD | NEW |