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