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

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

Issue 1165363003: Service Worker: Add ServiceWorkerContainer.getRegistrations() method. (Blink) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add method getRegistrations to global-interface-listing-expected.txt files. Created 5 years, 6 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/ServiceWorkerRegistration.h
diff --git a/Source/modules/serviceworkers/ServiceWorkerRegistration.h b/Source/modules/serviceworkers/ServiceWorkerRegistration.h
index ee19ccc6bf62be7bd821d14b10a822252f831e9b..6e09dc96b9efad91c3b0d120e2a0673528ddb654 100644
--- a/Source/modules/serviceworkers/ServiceWorkerRegistration.h
+++ b/Source/modules/serviceworkers/ServiceWorkerRegistration.h
@@ -8,6 +8,7 @@
#include "core/dom/ActiveDOMObject.h"
#include "core/events/EventTarget.h"
#include "modules/serviceworkers/ServiceWorker.h"
+#include "modules/serviceworkers/ServiceWorkerRegistration.h"
#include "platform/Supplementable.h"
#include "public/platform/WebServiceWorkerRegistration.h"
#include "public/platform/WebServiceWorkerRegistrationProxy.h"
@@ -83,6 +84,28 @@ private:
bool m_stopped;
};
+class ServiceWorkerRegistrationArray {
+public:
+ typedef WebVector<WebServiceWorkerRegistration*> WebType;
+ static HeapVector<Member<ServiceWorkerRegistration>> take(ScriptPromiseResolver* resolver, WebType* webServiceWorkerRegistrationsRaw)
+ {
+ OwnPtr<WebType> webServiceWorkerRegistrations = adoptPtr(webServiceWorkerRegistrationsRaw);
+ HeapVector<Member<ServiceWorkerRegistration>> registrations;
+ for (size_t i = 0; i < webServiceWorkerRegistrations->size(); ++i) {
+ registrations.append(ServiceWorkerRegistration::take(resolver, (*webServiceWorkerRegistrations)[i]));
+ }
+ return registrations;
+ }
+ static void dispose(WebType* webServiceWorkerRegistrationsRaw)
+ {
+ delete webServiceWorkerRegistrationsRaw;
+ }
+
+private:
+ WTF_MAKE_NONCOPYABLE(ServiceWorkerRegistrationArray);
+ ServiceWorkerRegistrationArray() = delete;
+};
+
} // namespace blink
#endif // ServiceWorkerRegistration_h
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.idl ('k') | public/platform/WebServiceWorkerProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698