OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CacheStorage_h | |
6 #define CacheStorage_h | |
7 | |
8 #include "bindings/core/v8/ScriptPromise.h" | |
9 #include "bindings/core/v8/ScriptState.h" | |
10 #include "bindings/core/v8/ScriptWrappable.h" | |
11 #include "modules/serviceworkers/Cache.h" | |
12 #include "modules/serviceworkers/CacheQueryOptions.h" | |
13 #include "public/platform/WebServiceWorkerCacheStorage.h" | |
14 #include "wtf/Forward.h" | |
15 #include "wtf/HashMap.h" | |
16 #include "wtf/Noncopyable.h" | |
17 | |
18 namespace blink { | |
19 | |
20 class Cache; | |
21 class WebServiceWorkerCacheStorage; | |
22 | |
23 class CacheStorage final : public GarbageCollectedFinalized<CacheStorage>, publi
c ScriptWrappable { | |
24 DEFINE_WRAPPERTYPEINFO(); | |
25 WTF_MAKE_NONCOPYABLE(CacheStorage); | |
26 public: | |
27 static CacheStorage* create(WebServiceWorkerCacheStorage*); | |
28 | |
29 ScriptPromise open(ScriptState*, const String& cacheName); | |
30 ScriptPromise has(ScriptState*, const String& cacheName); | |
31 ScriptPromise deleteFunction(ScriptState*, const String& cacheName); | |
32 ScriptPromise keys(ScriptState*); | |
33 ScriptPromise match(ScriptState*, const RequestInfo&, const CacheQueryOption
s&, ExceptionState&); | |
34 | |
35 | |
36 DECLARE_TRACE(); | |
37 | |
38 private: | |
39 class Callbacks; | |
40 class WithCacheCallbacks; | |
41 class DeleteCallbacks; | |
42 class KeysCallbacks; | |
43 class MatchCallbacks; | |
44 | |
45 friend class WithCacheCallbacks; | |
46 friend class DeleteCallbacks; | |
47 | |
48 explicit CacheStorage(PassOwnPtr<WebServiceWorkerCacheStorage>); | |
49 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption
s&); | |
50 | |
51 OwnPtr<WebServiceWorkerCacheStorage> m_webCacheStorage; | |
52 HeapHashMap<String, Member<Cache>> m_nameToCacheMap; | |
53 }; | |
54 | |
55 } // namespace blink | |
56 | |
57 #endif // CacheStorage_h | |
OLD | NEW |