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

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 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
Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index f966de158b6a7b134acaf53c78bd0cc1b3b8990e..3b0d18d337bb04040336a9e02a8ecc168dc89810 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -141,6 +141,21 @@ private:
UndefinedValue();
};
+class BooleanValue {
+public:
+ typedef bool WebType;
+ static bool take(ScriptPromiseResolver* resolver, WebType* boolean)
+ {
+ return *boolean;
+ }
+ static void dispose(WebType* boolean)
+ {
+ }
nhiroki 2014/08/29 07:17:53 nit: In blink, an empty function body seems to be
shimazu 2014/09/01 05:13:47 Done.
+
+private:
+ BooleanValue();
+};
+
ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ScriptState* scriptState, const String& pattern)
{
ASSERT(RuntimeEnabledFeatures::serviceWorkerEnabled());
@@ -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;
}

Powered by Google App Engine
This is Rietveld 408576698