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

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

Issue 1275903003: Service Worker: Stop using a scoped_ptr for an object to be released immediately. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6e9ecb402be63bb87af21b6a0b114cc76ddc6d87..76485877c5c891281985f549a621053d6ad1f9d2 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -119,10 +119,9 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
owned_callbacks(callbacks);
std::string error_message(kServiceWorkerRegisterErrorPrefix);
error_message += "The provided scriptURL or scope is too long.";
- scoped_ptr<WebServiceWorkerError> error(
+ callbacks->onError(
new WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
blink::WebString::fromUTF8(error_message)));
- callbacks->onError(error.release());
return;
}
@@ -170,10 +169,9 @@ void ServiceWorkerDispatcher::GetRegistration(
owned_callbacks(callbacks);
std::string error_message(kServiceWorkerGetRegistrationErrorPrefix);
error_message += "The provided documentURL is too long.";
- scoped_ptr<WebServiceWorkerError> error(
+ callbacks->onError(
new WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
blink::WebString::fromUTF8(error_message)));
- callbacks->onError(error.release());
return;
}
@@ -476,8 +474,8 @@ void ServiceWorkerDispatcher::OnDidGetRegistrations(
typedef blink::WebVector<blink::WebServiceWorkerRegistration*>
WebServiceWorkerRegistrationArray;
- scoped_ptr<WebServiceWorkerRegistrationArray>
- registrations(new WebServiceWorkerRegistrationArray(infos.size()));
+ WebServiceWorkerRegistrationArray* registrations =
+ new WebServiceWorkerRegistrationArray(infos.size());
for (size_t i = 0; i < infos.size(); ++i) {
if (infos[i].handle_id != kInvalidServiceWorkerHandleId) {
ServiceWorkerRegistrationObjectInfo info(infos[i]);
@@ -486,7 +484,7 @@ void ServiceWorkerDispatcher::OnDidGetRegistrations(
}
}
- callbacks->onSuccess(registrations.release());
+ callbacks->onSuccess(registrations);
pending_get_registrations_callbacks_.Remove(request_id);
}
@@ -534,9 +532,7 @@ void ServiceWorkerDispatcher::OnRegistrationError(
if (!callbacks)
return;
- scoped_ptr<WebServiceWorkerError> error(
- new WebServiceWorkerError(error_type, message));
- callbacks->onError(error.release());
+ callbacks->onError(new WebServiceWorkerError(error_type, message));
pending_registration_callbacks_.Remove(request_id);
}
@@ -603,9 +599,7 @@ void ServiceWorkerDispatcher::OnGetRegistrationError(
if (!callbacks)
return;
- scoped_ptr<WebServiceWorkerError> error(
- new WebServiceWorkerError(error_type, message));
- callbacks->onError(error.release());
+ callbacks->onError(new WebServiceWorkerError(error_type, message));
pending_get_registration_callbacks_.Remove(request_id);
}
@@ -628,9 +622,7 @@ void ServiceWorkerDispatcher::OnGetRegistrationsError(
if (!callbacks)
return;
- scoped_ptr<WebServiceWorkerError> error(
- new WebServiceWorkerError(error_type, message));
- callbacks->onError(error.release());
+ callbacks->onError(new WebServiceWorkerError(error_type, message));
pending_get_registrations_callbacks_.Remove(request_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698