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 Cache_h | 5 #ifndef Cache_h |
6 #define Cache_h | 6 #define Cache_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "public/platform/WebServiceWorkerCache.h" |
10 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
11 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 13 #include "wtf/OwnPtr.h" |
12 #include "wtf/RefCounted.h" | 14 #include "wtf/RefCounted.h" |
13 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
14 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
15 #include <v8.h> | 17 #include <v8.h> |
16 | 18 |
17 namespace blink { | 19 namespace blink { |
18 | 20 |
19 class Dictionary; | 21 class Dictionary; |
20 class Response; | 22 class Response; |
21 class Request; | 23 class Request; |
22 class ScriptState; | 24 class ScriptState; |
23 class WebServiceWorkerCache; | 25 class WebServiceWorkerCache; |
24 | 26 |
25 class Cache FINAL : public RefCountedWillBeGarbageCollected<Cache>, public Scrip
tWrappable { | 27 class Cache FINAL : public RefCountedWillBeGarbageCollected<Cache>, public Scrip
tWrappable, public WebServiceWorkerCache::ProxyInterface { |
26 WTF_MAKE_NONCOPYABLE(Cache); | 28 WTF_MAKE_NONCOPYABLE(Cache); |
27 public: | 29 public: |
28 static PassRefPtrWillBeRawPtr<Cache> fromWebServiceWorkerCache(WebServiceWor
kerCache*); | 30 static PassRefPtrWillBeRawPtr<Cache> fromWebServiceWorkerCache(WebServiceWor
kerCache*); |
29 | 31 |
| 32 virtual ~Cache(); |
| 33 |
30 // From Cache.idl: | 34 // From Cache.idl: |
31 ScriptPromise match(ScriptState*, Request*, const Dictionary& queryParams); | 35 ScriptPromise match(ScriptState*, Request*, const Dictionary& queryParams); |
32 ScriptPromise match(ScriptState*, const String&, const Dictionary& queryPara
ms); | 36 ScriptPromise match(ScriptState*, const String&, const Dictionary& queryPara
ms); |
33 ScriptPromise matchAll(ScriptState*, Request*, const Dictionary& queryParams
); | 37 ScriptPromise matchAll(ScriptState*, Request*, const Dictionary& queryParams
); |
34 ScriptPromise matchAll(ScriptState*, const String&, const Dictionary& queryP
arams); | 38 ScriptPromise matchAll(ScriptState*, const String&, const Dictionary& queryP
arams); |
35 ScriptPromise add(ScriptState*, Request*); | 39 ScriptPromise add(ScriptState*, Request*); |
36 ScriptPromise add(ScriptState*, const String&); | 40 ScriptPromise add(ScriptState*, const String&); |
37 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); | 41 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); |
38 ScriptPromise deleteFunction(ScriptState*, Request*, const Dictionary& query
Params); | 42 ScriptPromise deleteFunction(ScriptState*, Request*, const Dictionary& query
Params); |
39 ScriptPromise deleteFunction(ScriptState*, const String&, const Dictionary&
queryParams); | 43 ScriptPromise deleteFunction(ScriptState*, const String&, const Dictionary&
queryParams); |
40 ScriptPromise put(ScriptState*, Request*, Response*); | 44 ScriptPromise put(ScriptState*, Request*, Response*); |
41 ScriptPromise put(ScriptState*, const String&, Response*); | 45 ScriptPromise put(ScriptState*, const String&, Response*); |
42 ScriptPromise keys(ScriptState*); | 46 ScriptPromise keys(ScriptState*); |
43 ScriptPromise keys(ScriptState*, Request*, const Dictionary& queryParams); | 47 ScriptPromise keys(ScriptState*, Request*, const Dictionary& queryParams); |
44 ScriptPromise keys(ScriptState*, const String&, const Dictionary& queryParam
s); | 48 ScriptPromise keys(ScriptState*, const String&, const Dictionary& queryParam
s); |
45 | 49 |
46 void trace(Visitor*) { } | 50 void trace(Visitor*) { } |
47 | 51 |
48 private: | 52 private: |
49 explicit Cache(WebServiceWorkerCache* webCache); | 53 explicit Cache(WebServiceWorkerCache*); |
50 | 54 |
51 WebServiceWorkerCache const* ALLOW_UNUSED m_webCache; | 55 static PassRefPtrWillBeRawPtr<Cache> create(WebServiceWorkerCache*); |
| 56 |
| 57 ScriptPromise matchImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, const
Dictionary& queryParams); |
| 58 ScriptPromise matchAllImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, co
nst Dictionary& queryParams); |
| 59 ScriptPromise addImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>); |
| 60 ScriptPromise addAllImpl(ScriptState*, Vector<RefPtrWillBeRawPtr<Request> >)
; |
| 61 ScriptPromise deleteImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, cons
t Dictionary& queryParams); |
| 62 ScriptPromise putImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, Respons
e*); |
| 63 ScriptPromise keysImpl(ScriptState*); |
| 64 ScriptPromise keysImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, const
Dictionary& queryParams); |
| 65 |
| 66 OwnPtr<WebServiceWorkerCache> m_webCache; |
52 }; | 67 }; |
53 | 68 |
54 } // namespace blink | 69 } // namespace blink |
55 | 70 |
56 #endif // Cache_h | 71 #endif // Cache_h |
OLD | NEW |