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