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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 516823003: ServiceWorker: Change the return value of ServiceWorkerRegistration::unregister to boolean (2/4) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply 3-sided patch format 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: content/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index 779a4f461009e13e68cfcb368c51b0283dfa231c..ff716ecf0d69a65836c62a05adb5597e7e8938f3 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -92,7 +92,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
return;
}
- int request_id = pending_callbacks_.Add(callbacks);
+ int request_id = pending_registration_callbacks_.Add(callbacks);
thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker(
CurrentWorkerId(), request_id, provider_id, pattern, script_url));
}
@@ -100,11 +100,11 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
void ServiceWorkerDispatcher::UnregisterServiceWorker(
int provider_id,
const GURL& pattern,
- WebServiceWorkerRegistrationCallbacks* callbacks) {
+ WebServiceWorkerUnRegistrationCallbacks* callbacks) {
DCHECK(callbacks);
if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) {
- scoped_ptr<WebServiceWorkerRegistrationCallbacks>
+ scoped_ptr<WebServiceWorkerUnRegistrationCallbacks>
owned_callbacks(callbacks);
scoped_ptr<WebServiceWorkerError> error(new WebServiceWorkerError(
WebServiceWorkerError::ErrorTypeSecurity, "URL too long"));
@@ -112,7 +112,7 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker(
return;
}
- int request_id = pending_callbacks_.Add(callbacks);
+ int request_id = pending_unregistration_callbacks_.Add(callbacks);
thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker(
CurrentWorkerId(), request_id, provider_id, pattern));
}
@@ -240,26 +240,30 @@ void ServiceWorkerDispatcher::OnRegistered(
int request_id,
const ServiceWorkerRegistrationObjectInfo& info) {
WebServiceWorkerRegistrationCallbacks* callbacks =
- pending_callbacks_.Lookup(request_id);
+ pending_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks);
if (!callbacks)
return;
callbacks->onSuccess(GetServiceWorkerRegistration(info, true));
- pending_callbacks_.Remove(request_id);
+ pending_registration_callbacks_.Remove(request_id);
}
void ServiceWorkerDispatcher::OnUnregistered(
int thread_id,
int request_id) {
- WebServiceWorkerRegistrationCallbacks* callbacks =
- pending_callbacks_.Lookup(request_id);
+ WebServiceWorkerUnRegistrationCallbacks* callbacks =
+ pending_unregistration_callbacks_.Lookup(request_id);
DCHECK(callbacks);
if (!callbacks)
return;
-
+#ifdef SERVICEWORKER_UNREGISTER_DISABLE_NEW_FEATURE
callbacks->onSuccess(NULL);
- pending_callbacks_.Remove(request_id);
+#else
+ bool is_success = true;
+ callbacks->onSuccess(&is_success);
+#endif
+ pending_unregistration_callbacks_.Remove(request_id);
}
void ServiceWorkerDispatcher::OnRegistrationError(
@@ -268,7 +272,7 @@ void ServiceWorkerDispatcher::OnRegistrationError(
WebServiceWorkerError::ErrorType error_type,
const base::string16& message) {
WebServiceWorkerRegistrationCallbacks* callbacks =
- pending_callbacks_.Lookup(request_id);
+ pending_registration_callbacks_.Lookup(request_id);
DCHECK(callbacks);
if (!callbacks)
return;
@@ -276,7 +280,7 @@ void ServiceWorkerDispatcher::OnRegistrationError(
scoped_ptr<WebServiceWorkerError> error(
new WebServiceWorkerError(error_type, message));
callbacks->onError(error.release());
- pending_callbacks_.Remove(request_id);
+ pending_registration_callbacks_.Remove(request_id);
}
void ServiceWorkerDispatcher::OnServiceWorkerStateChanged(

Powered by Google App Engine
This is Rietveld 408576698