| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 , public ContextLifecycleObserver | 58 , public ContextLifecycleObserver |
| 59 , public WebServiceWorkerProviderClient { | 59 , public WebServiceWorkerProviderClient { |
| 60 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
| 61 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); | 61 USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); |
| 62 public: | 62 public: |
| 63 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; | 63 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; |
| 64 | 64 |
| 65 static ServiceWorkerContainer* create(ExecutionContext*); | 65 static ServiceWorkerContainer* create(ExecutionContext*); |
| 66 ~ServiceWorkerContainer(); | 66 ~ServiceWorkerContainer(); |
| 67 | 67 |
| 68 void willBeDetachedFromFrame(); | |
| 69 | |
| 70 DECLARE_VIRTUAL_TRACE(); | 68 DECLARE_VIRTUAL_TRACE(); |
| 71 | 69 |
| 72 ServiceWorker* controller() { return m_controller; } | 70 ServiceWorker* controller() { return m_controller; } |
| 73 ScriptPromise ready(ScriptState*); | 71 ScriptPromise ready(ScriptState*); |
| 74 WebServiceWorkerProvider* provider() { return m_provider; } | 72 WebServiceWorkerProvider* provider() { return m_provider; } |
| 75 | 73 |
| 76 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, std::unique_ptr<RegistrationCallbacks>); | 74 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, std::unique_ptr<RegistrationCallbacks>); |
| 77 | 75 |
| 78 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); | 76 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); |
| 79 ScriptPromise getRegistration(ScriptState*, const String& documentURL); | 77 ScriptPromise getRegistration(ScriptState*, const String& documentURL); |
| 80 ScriptPromise getRegistrations(ScriptState*); | 78 ScriptPromise getRegistrations(ScriptState*); |
| 81 | 79 |
| 80 void contextDestroyed() override; |
| 81 |
| 82 // WebServiceWorkerProviderClient overrides. | 82 // WebServiceWorkerProviderClient overrides. |
| 83 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; | 83 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; |
| 84 void dispatchMessageEvent(std::unique_ptr<WebServiceWorker::Handle>, const W
ebString& message, const WebMessagePortChannelArray&) override; | 84 void dispatchMessageEvent(std::unique_ptr<WebServiceWorker::Handle>, const W
ebString& message, const WebMessagePortChannelArray&) override; |
| 85 | 85 |
| 86 // EventTarget overrides. | 86 // EventTarget overrides. |
| 87 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } | 87 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } |
| 88 const AtomicString& interfaceName() const override; | 88 const AtomicString& interfaceName() const override; |
| 89 | 89 |
| 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(controllerchange); | 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(controllerchange); |
| 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 explicit ServiceWorkerContainer(ExecutionContext*); | 94 explicit ServiceWorkerContainer(ExecutionContext*); |
| 95 | 95 |
| 96 class GetRegistrationForReadyCallback; | 96 class GetRegistrationForReadyCallback; |
| 97 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, Member<Service
WorkerRegistration>, Member<ServiceWorkerRegistration>> ReadyProperty; | 97 typedef ScriptPromiseProperty<Member<ServiceWorkerContainer>, Member<Service
WorkerRegistration>, Member<ServiceWorkerRegistration>> ReadyProperty; |
| 98 ReadyProperty* createReadyProperty(); | 98 ReadyProperty* createReadyProperty(); |
| 99 | 99 |
| 100 WebServiceWorkerProvider* m_provider; | 100 WebServiceWorkerProvider* m_provider; |
| 101 Member<ServiceWorker> m_controller; | 101 Member<ServiceWorker> m_controller; |
| 102 Member<ReadyProperty> m_ready; | 102 Member<ReadyProperty> m_ready; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| 106 | 106 |
| 107 #endif // ServiceWorkerContainer_h | 107 #endif // ServiceWorkerContainer_h |
| OLD | NEW |