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