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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h

Issue 2564363002: ServiceWorker: Replace RegistrationCallback and GetRegistrationsCallback with CallbackPromiseAdapter (Closed)
Patch Set: base::MakeUnique 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
Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
index e5599ca2a2ec25c94afbfb8c1f63de8af937d07f..e24774a5f915119dc6885eeef1c433f8bb9d9697 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerRegistration.h
@@ -37,6 +37,12 @@ class ServiceWorkerRegistration final
USING_PRE_FINALIZER(ServiceWorkerRegistration, dispose);
public:
+ // Called from CallbackPromiseAdapter.
+ using WebType = std::unique_ptr<WebServiceWorkerRegistration::Handle>;
+ static ServiceWorkerRegistration* take(
+ ScriptPromiseResolver*,
+ std::unique_ptr<WebServiceWorkerRegistration::Handle>);
+
// ScriptWrappable overrides.
bool hasPendingActivity() const final;
@@ -102,14 +108,17 @@ class ServiceWorkerRegistrationArray {
STATIC_ONLY(ServiceWorkerRegistrationArray);
public:
+ // Called from CallbackPromiseAdapter.
+ using WebType = std::unique_ptr<
+ WebVector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>>;
static HeapVector<Member<ServiceWorkerRegistration>> take(
ScriptPromiseResolver* resolver,
- Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>*
- webServiceWorkerRegistrations) {
+ WebType webServiceWorkerRegistrations) {
HeapVector<Member<ServiceWorkerRegistration>> registrations;
- for (auto& registration : *webServiceWorkerRegistrations)
- registrations.append(ServiceWorkerRegistration::getOrCreate(
- resolver->getExecutionContext(), std::move(registration)));
+ for (auto& registration : *webServiceWorkerRegistrations) {
+ registrations.append(
+ ServiceWorkerRegistration::take(resolver, std::move(registration)));
+ }
return registrations;
}
};

Powered by Google App Engine
This is Rietveld 408576698