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

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

Issue 433793002: Introducing the WebServiceWorkerCache. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase on top of style nits cl Created 6 years, 3 months 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 "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "public/platform/WebServiceWorkerCache.h"
11 #include "public/platform/WebServiceWorkerCacheError.h" 12 #include "public/platform/WebServiceWorkerCacheError.h"
12 #include "wtf/Forward.h" 13 #include "wtf/Forward.h"
13 #include "wtf/Noncopyable.h" 14 #include "wtf/Noncopyable.h"
15 #include "wtf/OwnPtr.h"
14 #include "wtf/RefCounted.h" 16 #include "wtf/RefCounted.h"
15 #include "wtf/Vector.h" 17 #include "wtf/Vector.h"
16 #include "wtf/text/WTFString.h" 18 #include "wtf/text/WTFString.h"
17 #include <v8.h> 19 #include <v8.h>
18 20
19 namespace blink { 21 namespace blink {
20 22
21 class Dictionary; 23 class Dictionary;
22 class Response; 24 class Response;
23 class Request; 25 class Request;
24 class ScriptState; 26 class ScriptState;
25 class WebServiceWorkerCache; 27 class WebServiceWorkerCache;
26 28
27 class Cache FINAL : public RefCountedWillBeGarbageCollected<Cache>, public Scrip tWrappable { 29 class Cache FINAL : public RefCountedWillBeGarbageCollected<Cache>, public Scrip tWrappable, public WebServiceWorkerCache::ProxyInterface {
28 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
29 WTF_MAKE_NONCOPYABLE(Cache); 31 WTF_MAKE_NONCOPYABLE(Cache);
30 public: 32 public:
31 static PassRefPtrWillBeRawPtr<Cache> fromWebServiceWorkerCache(WebServiceWor kerCache*); 33 static PassRefPtrWillBeRawPtr<Cache> fromWebServiceWorkerCache(WebServiceWor kerCache*);
32 34
33 // From Cache.idl: 35 // From Cache.idl:
34 ScriptPromise match(ScriptState*, Request*, const Dictionary& queryParams); 36 ScriptPromise match(ScriptState*, Request*, const Dictionary& queryParams);
35 ScriptPromise match(ScriptState*, const String&, const Dictionary& queryPara ms); 37 ScriptPromise match(ScriptState*, const String&, const Dictionary& queryPara ms);
36 ScriptPromise matchAll(ScriptState*, Request*, const Dictionary& queryParams ); 38 ScriptPromise matchAll(ScriptState*, Request*, const Dictionary& queryParams );
37 ScriptPromise matchAll(ScriptState*, const String&, const Dictionary& queryP arams); 39 ScriptPromise matchAll(ScriptState*, const String&, const Dictionary& queryP arams);
38 ScriptPromise add(ScriptState*, Request*); 40 ScriptPromise add(ScriptState*, Request*);
39 ScriptPromise add(ScriptState*, const String&); 41 ScriptPromise add(ScriptState*, const String&);
40 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&); 42 ScriptPromise addAll(ScriptState*, const Vector<ScriptValue>&);
41 ScriptPromise deleteFunction(ScriptState*, Request*, const Dictionary& query Params); 43 ScriptPromise deleteFunction(ScriptState*, Request*, const Dictionary& query Params);
42 ScriptPromise deleteFunction(ScriptState*, const String&, const Dictionary& queryParams); 44 ScriptPromise deleteFunction(ScriptState*, const String&, const Dictionary& queryParams);
43 ScriptPromise put(ScriptState*, Request*, Response*); 45 ScriptPromise put(ScriptState*, Request*, Response*);
44 ScriptPromise put(ScriptState*, const String&, Response*); 46 ScriptPromise put(ScriptState*, const String&, Response*);
45 ScriptPromise keys(ScriptState*); 47 ScriptPromise keys(ScriptState*);
46 ScriptPromise keys(ScriptState*, Request*, const Dictionary& queryParams); 48 ScriptPromise keys(ScriptState*, Request*, const Dictionary& queryParams);
47 ScriptPromise keys(ScriptState*, const String&, const Dictionary& queryParam s); 49 ScriptPromise keys(ScriptState*, const String&, const Dictionary& queryParam s);
48 50
49 void trace(Visitor*) { } 51 void trace(Visitor*) { }
50 52
51 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError); 53 static PassRefPtrWillBeRawPtr<DOMException> domExceptionForCacheError(WebSer viceWorkerCacheError);
52 54
53 private: 55 private:
54 explicit Cache(WebServiceWorkerCache* webCache); 56 explicit Cache(WebServiceWorkerCache*);
55 57
56 WebServiceWorkerCache const* ALLOW_UNUSED m_webCache; 58 static PassRefPtrWillBeRawPtr<Cache> create(WebServiceWorkerCache*);
59
60 ScriptPromise matchImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, const Dictionary& queryParams);
61 ScriptPromise matchAllImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, co nst Dictionary& queryParams);
62 ScriptPromise addImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>);
63 ScriptPromise addAllImpl(ScriptState*, Vector<RefPtrWillBeRawPtr<Request> >) ;
64 ScriptPromise deleteImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, cons t Dictionary& queryParams);
65 ScriptPromise putImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, Respons e*);
66 ScriptPromise keysImpl(ScriptState*);
67 ScriptPromise keysImpl(ScriptState*, PassRefPtrWillBeRawPtr<Request>, const Dictionary& queryParams);
68
69 OwnPtr<WebServiceWorkerCache> m_webCache;
57 }; 70 };
58 71
59 } // namespace blink 72 } // namespace blink
60 73
61 #endif // Cache_h 74 #endif // Cache_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698