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

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

Issue 2564363002: ServiceWorker: Replace RegistrationCallback and GetRegistrationsCallback with CallbackPromiseAdapter (Closed)
Patch Set: Created 4 years 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 | content/child/service_worker/web_service_worker_registration_impl.h » ('j') | 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 c1934f515c181edec240f2fc7081ef25eac5cdae..20f03930b82924485af84b7bfe117f5868ddc666 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -523,21 +523,15 @@ void ServiceWorkerDispatcher::OnDidGetRegistrations(
if (!callbacks)
return;
- typedef blink::WebVector<blink::WebServiceWorkerRegistration::Handle*>
- WebServiceWorkerRegistrationArray;
- std::unique_ptr<WebServiceWorkerRegistrationArray> registrations(
- new WebServiceWorkerRegistrationArray(infos.size()));
+ using WebServiceWorkerRegistrationHandles =
+ WebServiceWorkerProvider::WebServiceWorkerRegistrationHandles;
+ std::unique_ptr<WebServiceWorkerRegistrationHandles> registrations(
+ new WebServiceWorkerRegistrationHandles(infos.size()));
shimazu 2016/12/12 11:04:53 nit: base::MakeUnique would be better than the bar
nhiroki 2016/12/13 03:16:27 Done.
for (size_t i = 0; i < infos.size(); ++i) {
- if (infos[i].handle_id != kInvalidServiceWorkerHandleId) {
- ServiceWorkerRegistrationObjectInfo info(infos[i]);
- ServiceWorkerVersionAttributes attr(attrs[i]);
-
- // WebServiceWorkerGetRegistrationsCallbacks cannot receive an array of
- // std::unique_ptr<WebServiceWorkerRegistration::Handle>, so create leaky
- // handles instead.
- (*registrations)[i] = WebServiceWorkerRegistrationImpl::CreateLeakyHandle(
- GetOrAdoptRegistration(info, attr));
- }
+ if (infos[i].handle_id == kInvalidServiceWorkerHandleId)
+ continue;
+ (*registrations)[i] = WebServiceWorkerRegistrationImpl::CreateHandle(
+ GetOrAdoptRegistration(infos[i], attrs[i]));
}
callbacks->onSuccess(std::move(registrations));
« no previous file with comments | « no previous file | content/child/service_worker/web_service_worker_registration_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698