Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: Source/modules/serviceworkers/Cache.h

Issue 700323003: Use Web IDL Union types in Service Worker's Cache interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "core/dom/DOMException.h" 11 #include "core/dom/DOMException.h"
11 #include "modules/serviceworkers/CacheQueryOptions.h" 12 #include "modules/serviceworkers/CacheQueryOptions.h"
12 #include "public/platform/WebServiceWorkerCache.h" 13 #include "public/platform/WebServiceWorkerCache.h"
13 #include "public/platform/WebServiceWorkerCacheError.h" 14 #include "public/platform/WebServiceWorkerCacheError.h"
14 #include "wtf/Forward.h" 15 #include "wtf/Forward.h"
15 #include "wtf/Noncopyable.h" 16 #include "wtf/Noncopyable.h"
16 #include "wtf/OwnPtr.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 20
20 namespace blink { 21 namespace blink {
21 22
22 class ExceptionState; 23 class ExceptionState;
23 class Response; 24 class Response;
24 class Request; 25 class Request;
25 class ScriptState; 26 class ScriptState;
26 27
28 typedef RequestOrUSVString RequestInfo;
29
27 class Cache final : public GarbageCollectedFinalized<Cache>, public ScriptWrappa ble { 30 class Cache final : public GarbageCollectedFinalized<Cache>, public ScriptWrappa ble {
28 DEFINE_WRAPPERTYPEINFO(); 31 DEFINE_WRAPPERTYPEINFO();
29 WTF_MAKE_NONCOPYABLE(Cache); 32 WTF_MAKE_NONCOPYABLE(Cache);
30 public: 33 public:
31 static Cache* create(WebServiceWorkerCache*); 34 static Cache* create(WebServiceWorkerCache*);
32 35
33 // From Cache.idl: 36 // From Cache.idl:
34 ScriptPromise match(ScriptState*, Request*, const CacheQueryOptions&); 37 ScriptPromise match(ScriptState*, const RequestInfo&, const CacheQueryOption s&, ExceptionState&);
35 ScriptPromise match(ScriptState*, const String&, const CacheQueryOptions&, E xceptionState&); 38 ScriptPromise matchAll(ScriptState*, const RequestInfo&, const CacheQueryOpt ions&, ExceptionState&);
36 ScriptPromise matchAll(ScriptState*, Request*, const CacheQueryOptions&); 39 ScriptPromise add(ScriptState*, const RequestInfo&, ExceptionState&);
37 ScriptPromise matchAll(ScriptState*, const String&, const CacheQueryOptions& , ExceptionState&);
38 ScriptPromise add(ScriptState*, Request*);
39 ScriptPromise add(ScriptState*, const String&, ExceptionState&);
40 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); 40 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&);
41 ScriptPromise deleteFunction(ScriptState*, Request*, const CacheQueryOptions &); 41 ScriptPromise deleteFunction(ScriptState*, const RequestInfo&, const CacheQu eryOptions&, ExceptionState&);
42 ScriptPromise deleteFunction(ScriptState*, const String&, const CacheQueryOp tions&, ExceptionState&); 42 ScriptPromise put(ScriptState*, const RequestInfo&, Response*, ExceptionStat e&);
43 ScriptPromise put(ScriptState*, Request*, Response*); 43 ScriptPromise keys(ScriptState*, ExceptionState&);
44 ScriptPromise put(ScriptState*, const String&, Response*, ExceptionState&); 44 ScriptPromise keys(ScriptState*, const RequestInfo&, const CacheQueryOptions &, ExceptionState&);
45 ScriptPromise keys(ScriptState*);
46 ScriptPromise keys(ScriptState*, Request*, const CacheQueryOptions&);
47 ScriptPromise keys(ScriptState*, const String&, const CacheQueryOptions&, Ex ceptionState&);
48 45
49 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError); 46 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError);
50 47
51 void trace(Visitor*) { } 48 void trace(Visitor*) { }
52 49
53 private: 50 private:
54 explicit Cache(WebServiceWorkerCache*); 51 explicit Cache(WebServiceWorkerCache*);
55 52
56 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption s&); 53 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption s&);
57 ScriptPromise matchAllImpl(ScriptState*, const Request*, const CacheQueryOpt ions&); 54 ScriptPromise matchAllImpl(ScriptState*, const Request*, const CacheQueryOpt ions&);
58 ScriptPromise addImpl(ScriptState*, const Request*); 55 ScriptPromise addImpl(ScriptState*, const Request*);
59 ScriptPromise addAllImpl(ScriptState*, const Vector<const Request*>); 56 ScriptPromise addAllImpl(ScriptState*, const Vector<const Request*>);
60 ScriptPromise deleteImpl(ScriptState*, const Request*, const CacheQueryOptio ns&); 57 ScriptPromise deleteImpl(ScriptState*, const Request*, const CacheQueryOptio ns&);
61 ScriptPromise putImpl(ScriptState*, const Request*, Response*); 58 ScriptPromise putImpl(ScriptState*, const Request*, Response*);
62 ScriptPromise keysImpl(ScriptState*); 59 ScriptPromise keysImpl(ScriptState*);
63 ScriptPromise keysImpl(ScriptState*, const Request*, const CacheQueryOptions &); 60 ScriptPromise keysImpl(ScriptState*, const Request*, const CacheQueryOptions &);
64 61
65 OwnPtr<WebServiceWorkerCache> m_webCache; 62 OwnPtr<WebServiceWorkerCache> m_webCache;
66 }; 63 };
67 64
68 } // namespace blink 65 } // namespace blink
69 66
70 #endif // Cache_h 67 #endif // Cache_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/UnionTypesCore.cpp ('k') | Source/modules/serviceworkers/Cache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698