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