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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 515083002: ServiceWorker: Change the return value of ServiceWorkerRegistration::unregister to boolean (1/4) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate the reviews in patch set 3, and rebase Created 6 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 | « no previous file | Source/modules/serviceworkers/ServiceWorkerRegistration.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index f966de158b6a7b134acaf53c78bd0cc1b3b8990e..a34f7748184e6c31e2d037b800df954a000843ca 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -124,6 +124,7 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
return promise;
}
+#ifdef DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN
class UndefinedValue {
public:
typedef WebServiceWorkerRegistration WebType;
@@ -140,6 +141,20 @@ public:
private:
UndefinedValue();
};
+#else
+class BooleanValue {
+public:
+ typedef bool WebType;
+ static bool take(ScriptPromiseResolver* resolver, WebType* boolean)
+ {
+ return *boolean;
+ }
+ static void dispose(WebType* boolean) { }
+
+private:
+ BooleanValue();
+};
+#endif
ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ScriptState* scriptState, const String& pattern)
{
@@ -167,8 +182,11 @@ ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ScriptState* scrip
resolver->reject(DOMException::create(SecurityError, "The scope must match the current origin."));
return promise;
}
-
+#ifdef DISABLE_SERVICEWORKER_UNREGISTER_RESOLVE_TO_BOOLEAN
m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<UndefinedValue, ServiceWorkerError>(resolver));
+#else
+ m_provider->unregisterServiceWorker(patternURL, new CallbackPromiseAdapter<BooleanValue, ServiceWorkerError>(resolver));
+#endif
return promise;
}
« no previous file with comments | « no previous file | Source/modules/serviceworkers/ServiceWorkerRegistration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698