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

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

Issue 694083002: Service Worker Cache: Simplify exception/rejection processing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add exception state to fixture 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
« no previous file with comments | « no previous file | Source/modules/serviceworkers/Cache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "modules/serviceworkers/CacheQueryOptions.h" 11 #include "modules/serviceworkers/CacheQueryOptions.h"
12 #include "public/platform/WebServiceWorkerCache.h" 12 #include "public/platform/WebServiceWorkerCache.h"
13 #include "public/platform/WebServiceWorkerCacheError.h" 13 #include "public/platform/WebServiceWorkerCacheError.h"
14 #include "wtf/Forward.h" 14 #include "wtf/Forward.h"
15 #include "wtf/Noncopyable.h" 15 #include "wtf/Noncopyable.h"
16 #include "wtf/OwnPtr.h" 16 #include "wtf/OwnPtr.h"
17 #include "wtf/Vector.h" 17 #include "wtf/Vector.h"
18 #include "wtf/text/WTFString.h" 18 #include "wtf/text/WTFString.h"
19 19
20 namespace blink { 20 namespace blink {
21 21
22 class ExceptionState;
22 class Response; 23 class Response;
23 class Request; 24 class Request;
24 class ScriptState; 25 class ScriptState;
25 26
26 class Cache final : public GarbageCollectedFinalized<Cache>, public ScriptWrappa ble { 27 class Cache final : public GarbageCollectedFinalized<Cache>, public ScriptWrappa ble {
27 DEFINE_WRAPPERTYPEINFO(); 28 DEFINE_WRAPPERTYPEINFO();
28 WTF_MAKE_NONCOPYABLE(Cache); 29 WTF_MAKE_NONCOPYABLE(Cache);
29 public: 30 public:
30 static Cache* create(WebServiceWorkerCache*); 31 static Cache* create(WebServiceWorkerCache*);
31 32
32 // From Cache.idl: 33 // From Cache.idl:
33 ScriptPromise match(ScriptState*, Request*, const CacheQueryOptions&); 34 ScriptPromise match(ScriptState*, Request*, const CacheQueryOptions&);
34 ScriptPromise match(ScriptState*, const String&, const CacheQueryOptions&); 35 ScriptPromise match(ScriptState*, const String&, const CacheQueryOptions&, E xceptionState&);
35 ScriptPromise matchAll(ScriptState*, Request*, const CacheQueryOptions&); 36 ScriptPromise matchAll(ScriptState*, Request*, const CacheQueryOptions&);
36 ScriptPromise matchAll(ScriptState*, const String&, const CacheQueryOptions& ); 37 ScriptPromise matchAll(ScriptState*, const String&, const CacheQueryOptions& , ExceptionState&);
37 ScriptPromise add(ScriptState*, Request*); 38 ScriptPromise add(ScriptState*, Request*);
38 ScriptPromise add(ScriptState*, const String&); 39 ScriptPromise add(ScriptState*, const String&, ExceptionState&);
39 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); 40 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&);
40 ScriptPromise deleteFunction(ScriptState*, Request*, const CacheQueryOptions &); 41 ScriptPromise deleteFunction(ScriptState*, Request*, const CacheQueryOptions &);
41 ScriptPromise deleteFunction(ScriptState*, const String&, const CacheQueryOp tions&); 42 ScriptPromise deleteFunction(ScriptState*, const String&, const CacheQueryOp tions&, ExceptionState&);
42 ScriptPromise put(ScriptState*, Request*, Response*); 43 ScriptPromise put(ScriptState*, Request*, Response*);
43 ScriptPromise put(ScriptState*, const String&, Response*); 44 ScriptPromise put(ScriptState*, const String&, Response*, ExceptionState&);
44 ScriptPromise keys(ScriptState*); 45 ScriptPromise keys(ScriptState*);
45 ScriptPromise keys(ScriptState*, Request*, const CacheQueryOptions&); 46 ScriptPromise keys(ScriptState*, Request*, const CacheQueryOptions&);
46 ScriptPromise keys(ScriptState*, const String&, const CacheQueryOptions&); 47 ScriptPromise keys(ScriptState*, const String&, const CacheQueryOptions&, Ex ceptionState&);
47 48
48 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError); 49 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError);
49 50
50 void trace(Visitor*) { } 51 void trace(Visitor*) { }
51 52
52 private: 53 private:
53 explicit Cache(WebServiceWorkerCache*); 54 explicit Cache(WebServiceWorkerCache*);
54 55
55 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption s&); 56 ScriptPromise matchImpl(ScriptState*, const Request*, const CacheQueryOption s&);
56 ScriptPromise matchAllImpl(ScriptState*, const Request*, const CacheQueryOpt ions&); 57 ScriptPromise matchAllImpl(ScriptState*, const Request*, const CacheQueryOpt ions&);
57 ScriptPromise addImpl(ScriptState*, const Request*); 58 ScriptPromise addImpl(ScriptState*, const Request*);
58 ScriptPromise addAllImpl(ScriptState*, const Vector<const Request*>); 59 ScriptPromise addAllImpl(ScriptState*, const Vector<const Request*>);
59 ScriptPromise deleteImpl(ScriptState*, const Request*, const CacheQueryOptio ns&); 60 ScriptPromise deleteImpl(ScriptState*, const Request*, const CacheQueryOptio ns&);
60 ScriptPromise putImpl(ScriptState*, const Request*, Response*); 61 ScriptPromise putImpl(ScriptState*, const Request*, Response*);
61 ScriptPromise keysImpl(ScriptState*); 62 ScriptPromise keysImpl(ScriptState*);
62 ScriptPromise keysImpl(ScriptState*, const Request*, const CacheQueryOptions &); 63 ScriptPromise keysImpl(ScriptState*, const Request*, const CacheQueryOptions &);
63 64
64 OwnPtr<WebServiceWorkerCache> m_webCache; 65 OwnPtr<WebServiceWorkerCache> m_webCache;
65 }; 66 };
66 67
67 } // namespace blink 68 } // namespace blink
68 69
69 #endif // Cache_h 70 #endif // Cache_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/serviceworkers/Cache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698