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 "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
12 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class Cache; | 17 class Cache; |
18 class WebServiceWorkerCacheStorage; | 18 class WebServiceWorkerCacheStorage; |
19 | 19 |
20 class CacheStorage final : public GarbageCollected<CacheStorage>, public ScriptW
rappable { | 20 class CacheStorage final : public GarbageCollected<CacheStorage>, public ScriptW
rappable { |
21 DEFINE_WRAPPERTYPEINFO(); | 21 DEFINE_WRAPPERTYPEINFO(); |
22 WTF_MAKE_NONCOPYABLE(CacheStorage); | 22 WTF_MAKE_NONCOPYABLE(CacheStorage); |
23 public: | 23 public: |
24 static CacheStorage* create(WebServiceWorkerCacheStorage*); | 24 static CacheStorage* create(WebServiceWorkerCacheStorage*); |
25 | 25 |
26 ScriptPromise get(ScriptState*, const String& cacheName); | 26 ScriptPromise open(ScriptState*, const String& cacheName); |
27 ScriptPromise has(ScriptState*, const String& cacheName); | 27 ScriptPromise has(ScriptState*, const String& cacheName); |
28 ScriptPromise createFunction(ScriptState*, const String& cacheName); | |
29 ScriptPromise deleteFunction(ScriptState*, const String& cacheName); | 28 ScriptPromise deleteFunction(ScriptState*, const String& cacheName); |
30 ScriptPromise keys(ScriptState*); | 29 ScriptPromise keys(ScriptState*); |
31 | 30 |
32 void trace(Visitor*); | 31 void trace(Visitor*); |
33 | 32 |
34 private: | 33 private: |
35 class Callbacks; | 34 class Callbacks; |
36 class WithCacheCallbacks; | 35 class WithCacheCallbacks; |
37 class DeleteCallbacks; | 36 class DeleteCallbacks; |
38 class KeysCallbacks; | 37 class KeysCallbacks; |
39 | 38 |
40 friend class WithCacheCallbacks; | 39 friend class WithCacheCallbacks; |
41 friend class DeleteCallbacks; | 40 friend class DeleteCallbacks; |
42 | 41 |
43 explicit CacheStorage(WebServiceWorkerCacheStorage*); | 42 explicit CacheStorage(WebServiceWorkerCacheStorage*); |
44 | 43 |
45 WebServiceWorkerCacheStorage* m_webCacheStorage; | 44 WebServiceWorkerCacheStorage* m_webCacheStorage; |
46 HeapHashMap<String, Member<Cache> > m_nameToCacheMap; | 45 HeapHashMap<String, Member<Cache> > m_nameToCacheMap; |
47 }; | 46 }; |
48 | 47 |
49 } // namespace blink | 48 } // namespace blink |
50 | 49 |
51 #endif // CacheStorage_h | 50 #endif // CacheStorage_h |
OLD | NEW |