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