OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef Cache_h | |
6 #define Cache_h | |
7 | |
8 #include "bindings/core/v8/ScriptPromise.h" | |
9 #include "bindings/core/v8/ScriptWrappable.h" | |
10 #include "bindings/modules/v8/UnionTypesModules.h" | |
11 #include "core/dom/DOMException.h" | |
12 #include "modules/serviceworkers/CacheQueryOptions.h" | |
13 #include "public/platform/WebServiceWorkerCache.h" | |
14 #include "public/platform/WebServiceWorkerCacheError.h" | |
15 #include "wtf/Forward.h" | |
16 #include "wtf/Noncopyable.h" | |
17 #include "wtf/OwnPtr.h" | |
18 #include "wtf/Vector.h" | |
19 #include "wtf/text/WTFString.h" | |
20 | |
21 namespace blink { | |
22 | |
23 class ExceptionState; | |
24 class Response; | |
25 class Request; | |
26 class ScriptState; | |
27 | |
28 typedef RequestOrUSVString RequestInfo; | |
29 | |
30 class Cache final : public GarbageCollectedFinalized<Cache>, public ScriptWrappa
ble { | |
31 DEFINE_WRAPPERTYPEINFO(); | |
32 WTF_MAKE_NONCOPYABLE(Cache); | |
33 public: | |
34 static Cache* create(WebServiceWorkerCache*); | |
35 | |
36 // From Cache.idl: | |
37 ScriptPromise match(ScriptState*, const RequestInfo&, const CacheQueryOption
s&, ExceptionState&); | |
38 ScriptPromise matchAll(ScriptState*, const RequestInfo&, const CacheQueryOpt
ions&, ExceptionState&); | |
39 ScriptPromise add(ScriptState*, const RequestInfo&, ExceptionState&); | |
40 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); | |
41 ScriptPromise deleteFunction(ScriptState*, const RequestInfo&, const CacheQu
eryOptions&, ExceptionState&); | |
42 ScriptPromise put(ScriptState*, const RequestInfo&, Response*, ExceptionStat
e&); | |
43 ScriptPromise keys(ScriptState*, ExceptionState&); | |
44 ScriptPromise keys(ScriptState*, const RequestInfo&, const CacheQueryOptions
&, ExceptionState&); | |
45 | |
46 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer
viceWorkerCacheError); | |
47 | |
48 static WebServiceWorkerCache::QueryParams toWebQueryParams(const CacheQueryO
ptions&); | |
49 | |
50 DEFINE_INLINE_TRACE() { } | |
51 | |
52 private: | |
53 class AsyncPutBatch; | |
54 explicit Cache(WebServiceWorkerCache*); | |
55 | |
56 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption
s&); | |
57 ScriptPromise matchAllImpl(ScriptState*, const Request*, const CacheQueryOpt
ions&); | |
58 ScriptPromise addImpl(ScriptState*, const Request*); | |
59 ScriptPromise addAllImpl(ScriptState*, const Vector<const Request*>); | |
60 ScriptPromise deleteImpl(ScriptState*, const Request*, const CacheQueryOptio
ns&); | |
61 ScriptPromise putImpl(ScriptState*, Request*, Response*); | |
62 ScriptPromise keysImpl(ScriptState*); | |
63 ScriptPromise keysImpl(ScriptState*, const Request*, const CacheQueryOptions
&); | |
64 | |
65 WebServiceWorkerCache* webCache() const; | |
66 | |
67 OwnPtr<WebServiceWorkerCache> m_webCache; | |
68 }; | |
69 | |
70 } // namespace blink | |
71 | |
72 #endif // Cache_h | |
OLD | NEW |