| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ServiceWorkerRegistration_h | 5 #ifndef ServiceWorkerRegistration_h |
| 6 #define ServiceWorkerRegistration_h | 6 #define ServiceWorkerRegistration_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/ActiveDOMObject.h" | 10 #include "core/dom/ActiveDOMObject.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 : public EventTargetWithInlineData, | 30 : public EventTargetWithInlineData, |
| 31 public ActiveScriptWrappable, | 31 public ActiveScriptWrappable, |
| 32 public ActiveDOMObject, | 32 public ActiveDOMObject, |
| 33 public WebServiceWorkerRegistrationProxy, | 33 public WebServiceWorkerRegistrationProxy, |
| 34 public Supplementable<ServiceWorkerRegistration> { | 34 public Supplementable<ServiceWorkerRegistration> { |
| 35 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
| 36 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration); | 36 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerRegistration); |
| 37 USING_PRE_FINALIZER(ServiceWorkerRegistration, dispose); | 37 USING_PRE_FINALIZER(ServiceWorkerRegistration, dispose); |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 // Called from CallbackPromiseAdapter. |
| 41 using WebType = std::unique_ptr<WebServiceWorkerRegistration::Handle>; |
| 42 static ServiceWorkerRegistration* take( |
| 43 ScriptPromiseResolver*, |
| 44 std::unique_ptr<WebServiceWorkerRegistration::Handle>); |
| 45 |
| 40 // ScriptWrappable overrides. | 46 // ScriptWrappable overrides. |
| 41 bool hasPendingActivity() const final; | 47 bool hasPendingActivity() const final; |
| 42 | 48 |
| 43 // EventTarget overrides. | 49 // EventTarget overrides. |
| 44 const AtomicString& interfaceName() const override; | 50 const AtomicString& interfaceName() const override; |
| 45 ExecutionContext* getExecutionContext() const override { | 51 ExecutionContext* getExecutionContext() const override { |
| 46 return ActiveDOMObject::getExecutionContext(); | 52 return ActiveDOMObject::getExecutionContext(); |
| 47 } | 53 } |
| 48 | 54 |
| 49 // WebServiceWorkerRegistrationProxy overrides. | 55 // WebServiceWorkerRegistrationProxy overrides. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 Member<ServiceWorker> m_active; | 101 Member<ServiceWorker> m_active; |
| 96 Member<NavigationPreloadManager> m_navigationPreload; | 102 Member<NavigationPreloadManager> m_navigationPreload; |
| 97 | 103 |
| 98 bool m_stopped; | 104 bool m_stopped; |
| 99 }; | 105 }; |
| 100 | 106 |
| 101 class ServiceWorkerRegistrationArray { | 107 class ServiceWorkerRegistrationArray { |
| 102 STATIC_ONLY(ServiceWorkerRegistrationArray); | 108 STATIC_ONLY(ServiceWorkerRegistrationArray); |
| 103 | 109 |
| 104 public: | 110 public: |
| 111 // Called from CallbackPromiseAdapter. |
| 112 using WebType = std::unique_ptr< |
| 113 WebVector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>>; |
| 105 static HeapVector<Member<ServiceWorkerRegistration>> take( | 114 static HeapVector<Member<ServiceWorkerRegistration>> take( |
| 106 ScriptPromiseResolver* resolver, | 115 ScriptPromiseResolver* resolver, |
| 107 Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>>* | 116 WebType webServiceWorkerRegistrations) { |
| 108 webServiceWorkerRegistrations) { | |
| 109 HeapVector<Member<ServiceWorkerRegistration>> registrations; | 117 HeapVector<Member<ServiceWorkerRegistration>> registrations; |
| 110 for (auto& registration : *webServiceWorkerRegistrations) | 118 for (auto& registration : *webServiceWorkerRegistrations) { |
| 111 registrations.append(ServiceWorkerRegistration::getOrCreate( | 119 registrations.append( |
| 112 resolver->getExecutionContext(), std::move(registration))); | 120 ServiceWorkerRegistration::take(resolver, std::move(registration))); |
| 121 } |
| 113 return registrations; | 122 return registrations; |
| 114 } | 123 } |
| 115 }; | 124 }; |
| 116 | 125 |
| 117 } // namespace blink | 126 } // namespace blink |
| 118 | 127 |
| 119 #endif // ServiceWorkerRegistration_h | 128 #endif // ServiceWorkerRegistration_h |
| OLD | NEW |