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

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

Issue 1312343004: [ServiceWorker] 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 | « Source/modules/serviceworkers/ServiceWorkerRegistration.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/WebServiceWorkerProvider.h
diff --git a/public/platform/modules/serviceworker/WebServiceWorkerProvider.h b/public/platform/modules/serviceworker/WebServiceWorkerProvider.h
index 7b2123abbd9e0c7eea77bb16c8ad3f6d407309e6..f10faf3a90b5bcec591880d5dd03fa55b6d06d3a 100644
--- a/public/platform/modules/serviceworker/WebServiceWorkerProvider.h
+++ b/public/platform/modules/serviceworker/WebServiceWorkerProvider.h
@@ -32,6 +32,7 @@
#define WebServiceWorkerProvider_h
#include "public/platform/WebCallbacks.h"
+#include "public/platform/WebPassOwnPtr.h"
#include "public/platform/WebServiceWorkerRegistration.h"
#include "public/platform/WebVector.h"
@@ -51,12 +52,34 @@ public:
// events. Must be cleared before the client becomes invalid.
virtual void setClient(WebServiceWorkerProviderClient*) { }
- // The WebServiceWorkerRegistration and WebServiceWorkerError ownership are
- // passed to the WebServiceWorkerRegistrationCallbacks implementation.
- typedef WebCallbacks<WebServiceWorkerRegistration*, WebServiceWorkerError*> WebServiceWorkerRegistrationCallbacks;
- typedef WebCallbacks<WebServiceWorkerRegistration*, WebServiceWorkerError*> WebServiceWorkerGetRegistrationCallbacks;
- typedef WebCallbacks<WebVector<WebServiceWorkerRegistration*>*, WebServiceWorkerError*> WebServiceWorkerGetRegistrationsCallbacks;
- typedef WebCallbacks<WebServiceWorkerRegistration*, void> WebServiceWorkerGetRegistrationForReadyCallbacks;
+ class WebServiceWorkerRegistrationCallbacks : public WebCallbacks<WebPassOwnPtr<WebServiceWorkerRegistration>, const WebServiceWorkerError&> {
+ public:
+ void onSuccess(WebServiceWorkerRegistration* r) { onSuccess(adoptWebPtr(r)); }
+ void onError(WebServiceWorkerError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ virtual void onSuccess(WebPassOwnPtr<WebServiceWorkerRegistration>) = 0;
+ virtual void onError(const WebServiceWorkerError&) = 0;
+ };
+ using WebServiceWorkerGetRegistrationCallbacks = WebServiceWorkerRegistrationCallbacks;
+ class WebServiceWorkerGetRegistrationsCallbacks : public WebCallbacks<WebPassOwnPtr<WebVector<WebServiceWorkerRegistration*>>, const WebServiceWorkerError&> {
+ public:
+ void onSuccess(WebVector<WebServiceWorkerRegistration*>* r) { onSuccess(adoptWebPtr(r)); }
+ void onError(WebServiceWorkerError* e)
+ {
+ onError(*e);
+ delete e;
+ }
+ virtual void onSuccess(WebPassOwnPtr<WebVector<WebServiceWorkerRegistration*>>) = 0;
+ virtual void onError(const WebServiceWorkerError&) = 0;
+ };
+ class WebServiceWorkerGetRegistrationForReadyCallbacks : public WebCallbacks<WebPassOwnPtr<WebServiceWorkerRegistration>, void> {
+ public:
+ void onSuccess(WebServiceWorkerRegistration* r) { onSuccess(adoptWebPtr(r)); }
+ virtual void onSuccess(WebPassOwnPtr<WebServiceWorkerRegistration>) = 0;
+ };
virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scriptUrl, WebServiceWorkerRegistrationCallbacks*) { }
virtual void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegistrationCallbacks*) { }
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerRegistration.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698