| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 42 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
| 43 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
| 44 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 44 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
| 45 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h
" | 45 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h
" |
| 46 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
| 47 #include <memory> | 47 #include <memory> |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 class ExecutionContext; | 51 class ExecutionContext; |
| 52 class NavigatorServiceWorker; |
| 52 class WebServiceWorker; | 53 class WebServiceWorker; |
| 53 class WebServiceWorkerProvider; | 54 class WebServiceWorkerProvider; |
| 54 | 55 |
| 55 class MODULES_EXPORT ServiceWorkerContainer final | 56 class MODULES_EXPORT ServiceWorkerContainer final |
| 56 : public EventTargetWithInlineData, | 57 : public EventTargetWithInlineData, |
| 57 public ContextLifecycleObserver, | 58 public ContextLifecycleObserver, |
| 58 public WebServiceWorkerProviderClient { | 59 public WebServiceWorkerProviderClient { |
| 59 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
| 60 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); | 61 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); |
| 61 | 62 |
| 62 public: | 63 public: |
| 63 using RegistrationCallbacks = | 64 using RegistrationCallbacks = |
| 64 WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks; | 65 WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks; |
| 65 | 66 |
| 66 static ServiceWorkerContainer* create(ExecutionContext*); | 67 static ServiceWorkerContainer* create(ExecutionContext*, |
| 68 NavigatorServiceWorker*); |
| 67 ~ServiceWorkerContainer(); | 69 ~ServiceWorkerContainer(); |
| 68 | 70 |
| 69 DECLARE_VIRTUAL_TRACE(); | 71 DECLARE_VIRTUAL_TRACE(); |
| 70 | 72 |
| 71 ServiceWorker* controller() { return m_controller; } | 73 ServiceWorker* controller() { return m_controller; } |
| 72 ScriptPromise ready(ScriptState*); | 74 ScriptPromise ready(ScriptState*); |
| 73 WebServiceWorkerProvider* provider() { return m_provider; } | 75 WebServiceWorkerProvider* provider() { return m_provider; } |
| 74 | 76 |
| 75 void registerServiceWorkerImpl(ExecutionContext*, | 77 void registerServiceWorkerImpl(ExecutionContext*, |
| 76 const KURL& scriptURL, | 78 const KURL& scriptURL, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 95 // EventTarget overrides. | 97 // EventTarget overrides. |
| 96 ExecutionContext* getExecutionContext() const override { | 98 ExecutionContext* getExecutionContext() const override { |
| 97 return ContextLifecycleObserver::getExecutionContext(); | 99 return ContextLifecycleObserver::getExecutionContext(); |
| 98 } | 100 } |
| 99 const AtomicString& interfaceName() const override; | 101 const AtomicString& interfaceName() const override; |
| 100 | 102 |
| 101 DEFINE_ATTRIBUTE_EVENT_LISTENER(controllerchange); | 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(controllerchange); |
| 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 103 | 105 |
| 104 private: | 106 private: |
| 105 explicit ServiceWorkerContainer(ExecutionContext*); | 107 ServiceWorkerContainer(ExecutionContext*, NavigatorServiceWorker*); |
| 106 | 108 |
| 107 class GetRegistrationForReadyCallback; | 109 class GetRegistrationForReadyCallback; |
| 108 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, | 110 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, |
| 109 Member<ServiceWorkerRegistration>, | 111 Member<ServiceWorkerRegistration>, |
| 110 Member<ServiceWorkerRegistration>> | 112 Member<ServiceWorkerRegistration>> |
| 111 ReadyProperty; | 113 ReadyProperty; |
| 112 ReadyProperty* createReadyProperty(); | 114 ReadyProperty* createReadyProperty(); |
| 113 | 115 |
| 114 WebServiceWorkerProvider* m_provider; | 116 WebServiceWorkerProvider* m_provider; |
| 115 Member<ServiceWorker> m_controller; | 117 Member<ServiceWorker> m_controller; |
| 116 Member<ReadyProperty> m_ready; | 118 Member<ReadyProperty> m_ready; |
| 119 Member<NavigatorServiceWorker> m_navigator; |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 } // namespace blink | 122 } // namespace blink |
| 120 | 123 |
| 121 #endif // ServiceWorkerContainer_h | 124 #endif // ServiceWorkerContainer_h |
| OLD | NEW |