| 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 <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/public/child/worker_thread.h" | 17 #include "content/public/child/worker_thread.h" |
| 18 #include "content/public/renderer/render_process_observer.h" | 18 #include "content/public/renderer/render_process_observer.h" |
| 19 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" | 19 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" |
| 20 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheError.h" | 20 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheError.h" |
| 21 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheStorage.h" | 21 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheStorage.h" |
| 22 | 22 |
| 23 namespace url { |
| 24 class Origin; |
| 25 } |
| 26 |
| 23 namespace content { | 27 namespace content { |
| 24 | 28 |
| 25 class ThreadSafeSender; | 29 class ThreadSafeSender; |
| 26 struct ServiceWorkerFetchRequest; | 30 struct ServiceWorkerFetchRequest; |
| 27 struct ServiceWorkerResponse; | 31 struct ServiceWorkerResponse; |
| 28 | 32 |
| 29 // Handle the Cache Storage messaging for this context thread. The | 33 // Handle the Cache Storage messaging for this context thread. The |
| 30 // main thread and each worker thread have their own instances. | 34 // main thread and each worker thread have their own instances. |
| 31 class CacheStorageDispatcher : public WorkerThread::Observer { | 35 class CacheStorageDispatcher : public WorkerThread::Observer { |
| 32 public: | 36 public: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 int request_id, | 102 int request_id, |
| 99 blink::WebServiceWorkerCacheError reason); | 103 blink::WebServiceWorkerCacheError reason); |
| 100 void OnCacheBatchError(int thread_id, | 104 void OnCacheBatchError(int thread_id, |
| 101 int request_id, | 105 int request_id, |
| 102 blink::WebServiceWorkerCacheError reason); | 106 blink::WebServiceWorkerCacheError reason); |
| 103 | 107 |
| 104 // TODO(jsbell): These are only called by WebServiceWorkerCacheStorageImpl | 108 // TODO(jsbell): These are only called by WebServiceWorkerCacheStorageImpl |
| 105 // and should be renamed to match Chromium conventions. crbug.com/439389 | 109 // and should be renamed to match Chromium conventions. crbug.com/439389 |
| 106 void dispatchHas( | 110 void dispatchHas( |
| 107 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, | 111 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, |
| 108 const GURL& origin, | 112 const url::Origin& origin, |
| 109 const blink::WebString& cacheName); | 113 const blink::WebString& cacheName); |
| 110 void dispatchOpen( | 114 void dispatchOpen( |
| 111 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks* | 115 blink::WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks* |
| 112 callbacks, | 116 callbacks, |
| 113 const GURL& origin, | 117 const url::Origin& origin, |
| 114 const blink::WebString& cacheName); | 118 const blink::WebString& cacheName); |
| 115 void dispatchDelete( | 119 void dispatchDelete( |
| 116 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, | 120 blink::WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks, |
| 117 const GURL& origin, | 121 const url::Origin& origin, |
| 118 const blink::WebString& cacheName); | 122 const blink::WebString& cacheName); |
| 119 void dispatchKeys( | 123 void dispatchKeys( |
| 120 blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks* callbacks, | 124 blink::WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks* callbacks, |
| 121 const GURL& origin); | 125 const url::Origin& origin); |
| 122 void dispatchMatch( | 126 void dispatchMatch( |
| 123 blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks* | 127 blink::WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks* |
| 124 callbacks, | 128 callbacks, |
| 125 const GURL& origin, | 129 const url::Origin& origin, |
| 126 const blink::WebServiceWorkerRequest& request, | 130 const blink::WebServiceWorkerRequest& request, |
| 127 const blink::WebServiceWorkerCache::QueryParams& query_params); | 131 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| 128 | 132 |
| 129 // These methods are used by WebCache to forward events to the browser | 133 // These methods are used by WebCache to forward events to the browser |
| 130 // process. | 134 // process. |
| 131 void dispatchMatchForCache( | 135 void dispatchMatchForCache( |
| 132 int cache_id, | 136 int cache_id, |
| 133 blink::WebServiceWorkerCache::CacheMatchCallbacks* callbacks, | 137 blink::WebServiceWorkerCache::CacheMatchCallbacks* callbacks, |
| 134 const blink::WebServiceWorkerRequest& request, | 138 const blink::WebServiceWorkerRequest& request, |
| 135 const blink::WebServiceWorkerCache::QueryParams& query_params); | 139 const blink::WebServiceWorkerCache::QueryParams& query_params); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 TimeMap cache_batch_times_; | 218 TimeMap cache_batch_times_; |
| 215 | 219 |
| 216 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; | 220 base::WeakPtrFactory<CacheStorageDispatcher> weak_factory_; |
| 217 | 221 |
| 218 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); | 222 DISALLOW_COPY_AND_ASSIGN(CacheStorageDispatcher); |
| 219 }; | 223 }; |
| 220 | 224 |
| 221 } // namespace content | 225 } // namespace content |
| 222 | 226 |
| 223 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ | 227 #endif // CONTENT_RENDERER_CACHE_STORAGE_CACHE_STORAGE_DISPATCHER_H_ |
| OLD | NEW |