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

Unified Diff: public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h

Issue 1284173004: [CacheStorage] Use appopriate type parameters for WebCallbacks (1/3). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « public/platform/modules/serviceworker/WebServiceWorkerCache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h
diff --git a/public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h b/public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h
index 3fe844a1cdcdbe56507f84555305d35d9a9eb6a6..15edab7e6780bf8a1da47b709a93bae0eb3746d1 100644
--- a/public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h
+++ b/public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h
@@ -7,6 +7,7 @@
#include "public/platform/WebCallbacks.h"
#include "public/platform/WebCommon.h"
+#include "public/platform/WebPassOwnPtr.h"
#include "public/platform/WebServiceWorkerCache.h"
#include "public/platform/WebServiceWorkerCacheError.h"
#include "public/platform/WebString.h"
@@ -21,10 +22,51 @@ class WebServiceWorkerCache;
// after operations complete.
class WebServiceWorkerCacheStorage {
public:
- typedef WebCallbacks<void, WebServiceWorkerCacheError*> CacheStorageCallbacks;
- typedef WebCallbacks<WebServiceWorkerCache*, WebServiceWorkerCacheError*> CacheStorageWithCacheCallbacks;
- typedef WebCallbacks<WebVector<WebString>*, WebServiceWorkerCacheError*> CacheStorageKeysCallbacks;
- typedef WebCallbacks<WebServiceWorkerResponse*, WebServiceWorkerCacheError*> CacheStorageMatchCallbacks;
+ class CacheStorageCallbacks : public WebCallbacks<void, WebServiceWorkerCacheError> {
+ public:
+ void onError(WebServiceWorkerCacheError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onError(WebServiceWorkerCacheError) override {}
+ };
+ class CacheStorageWithCacheCallbacks : public WebCallbacks<WebPassOwnPtr<WebServiceWorkerCache>, WebServiceWorkerCacheError> {
+ public:
+ void onSuccess(WebServiceWorkerCache* r)
+ {
+ onSuccess(adoptWebPtr(r));
+ }
+ void onError(WebServiceWorkerCacheError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onSuccess(WebPassOwnPtr<WebServiceWorkerCache>) override {}
+ void onError(WebServiceWorkerCacheError) override {}
+ };
+ class CacheStorageKeysCallbacks : public WebCallbacks<const WebVector<WebString>&, WebServiceWorkerCacheError> {
+ public:
+ void onSuccess(WebVector<WebString>* r) { onSuccess(*r); }
+ void onError(WebServiceWorkerCacheError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onSuccess(const WebVector<WebString>&) override {}
+ void onError(WebServiceWorkerCacheError) override {}
+ };
+ class CacheStorageMatchCallbacks : public WebCallbacks<const WebServiceWorkerResponse&, WebServiceWorkerCacheError> {
+ public:
+ void onSuccess(WebServiceWorkerResponse* r) { onSuccess(*r); }
+ void onError(WebServiceWorkerCacheError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ void onSuccess(const WebServiceWorkerResponse&) override {}
+ void onError(WebServiceWorkerCacheError) override {}
+ };
virtual ~WebServiceWorkerCacheStorage() { }
« no previous file with comments | « public/platform/modules/serviceworker/WebServiceWorkerCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698