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_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/child/thread_safe_sender.h" | 9 #include "content/child/thread_safe_sender.h" |
10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
11 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" | 11 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" |
12 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheError.h" | 12 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheError.h" |
13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheStorage.h" | 13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCacheStorage.h" |
| 14 #include "url/origin.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class CacheStorageDispatcher; | 18 class CacheStorageDispatcher; |
18 class ThreadSafeSender; | 19 class ThreadSafeSender; |
19 | 20 |
20 // This corresponds to an instance of the script-facing CacheStorage object. | 21 // This corresponds to an instance of the script-facing CacheStorage object. |
21 // One exists per script execution context (window, worker) and has an origin | 22 // One exists per script execution context (window, worker) and has an origin |
22 // which provides a namespace for the caches. Script calls to the CacheStorage | 23 // which provides a namespace for the caches. Script calls to the CacheStorage |
23 // object are routed through here to the (per-thread) dispatcher then on to | 24 // object are routed through here to the (per-thread) dispatcher then on to |
24 // the browser, with the origin added to the call parameters. Cache instances | 25 // the browser, with the origin added to the call parameters. Cache instances |
25 // returned by open() calls are minted by and implemented within the code of | 26 // returned by open() calls are minted by and implemented within the code of |
26 // the CacheStorageDispatcher, and include routing information. | 27 // the CacheStorageDispatcher, and include routing information. |
27 class WebServiceWorkerCacheStorageImpl | 28 class WebServiceWorkerCacheStorageImpl |
28 : public blink::WebServiceWorkerCacheStorage { | 29 : public blink::WebServiceWorkerCacheStorage { |
29 public: | 30 public: |
30 WebServiceWorkerCacheStorageImpl(ThreadSafeSender* thread_safe_sender, | 31 WebServiceWorkerCacheStorageImpl(ThreadSafeSender* thread_safe_sender, |
31 const GURL& origin); | 32 const url::Origin& origin); |
32 ~WebServiceWorkerCacheStorageImpl() override; | 33 ~WebServiceWorkerCacheStorageImpl() override; |
33 | 34 |
34 // From WebServiceWorkerCacheStorage: | 35 // From WebServiceWorkerCacheStorage: |
35 void dispatchHas(CacheStorageCallbacks* callbacks, | 36 void dispatchHas(CacheStorageCallbacks* callbacks, |
36 const blink::WebString& cacheName) override; | 37 const blink::WebString& cacheName) override; |
37 void dispatchOpen(CacheStorageWithCacheCallbacks* callbacks, | 38 void dispatchOpen(CacheStorageWithCacheCallbacks* callbacks, |
38 const blink::WebString& cacheName) override; | 39 const blink::WebString& cacheName) override; |
39 void dispatchDelete(CacheStorageCallbacks* callbacks, | 40 void dispatchDelete(CacheStorageCallbacks* callbacks, |
40 const blink::WebString& cacheName) override; | 41 const blink::WebString& cacheName) override; |
41 void dispatchKeys(CacheStorageKeysCallbacks* callbacks) override; | 42 void dispatchKeys(CacheStorageKeysCallbacks* callbacks) override; |
42 void dispatchMatch( | 43 void dispatchMatch( |
43 CacheStorageMatchCallbacks* callbacks, | 44 CacheStorageMatchCallbacks* callbacks, |
44 const blink::WebServiceWorkerRequest& request, | 45 const blink::WebServiceWorkerRequest& request, |
45 const blink::WebServiceWorkerCache::QueryParams& query_params) override; | 46 const blink::WebServiceWorkerCache::QueryParams& query_params) override; |
46 | 47 |
47 private: | 48 private: |
48 // Helper to return the thread-specific dispatcher. | 49 // Helper to return the thread-specific dispatcher. |
49 CacheStorageDispatcher* GetDispatcher() const; | 50 CacheStorageDispatcher* GetDispatcher() const; |
50 | 51 |
51 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 52 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
52 const GURL origin_; | 53 const url::Origin origin_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerCacheStorageImpl); | 55 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerCacheStorageImpl); |
55 }; | 56 }; |
56 | 57 |
57 } // namespace content | 58 } // namespace content |
58 | 59 |
59 #endif // CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL
_H_ | 60 #endif // CONTENT_RENDERER_SERVICE_WORKER_WEB_SERVICE_WORKER_CACHE_STORAGE_IMPL
_H_ |
OLD | NEW |