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