| 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 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/ScriptPromise.h" | 34 #include "bindings/core/v8/ScriptPromise.h" |
| 35 #include "bindings/core/v8/ScriptPromiseProperty.h" | 35 #include "bindings/core/v8/ScriptPromiseProperty.h" |
| 36 #include "bindings/core/v8/ScriptWrappable.h" | 36 #include "bindings/core/v8/ScriptWrappable.h" |
| 37 #include "core/dom/ContextLifecycleObserver.h" | 37 #include "core/dom/ContextLifecycleObserver.h" |
| 38 #include "core/events/EventTarget.h" | 38 #include "core/events/EventTarget.h" |
| 39 #include "modules/ModulesExport.h" | 39 #include "modules/ModulesExport.h" |
| 40 #include "modules/serviceworkers/RegistrationOptions.h" | 40 #include "modules/serviceworkers/RegistrationOptions.h" |
| 41 #include "modules/serviceworkers/ServiceWorker.h" | 41 #include "modules/serviceworkers/ServiceWorker.h" |
| 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/WebServiceWorkerProviderClient.h
" | 45 #include "public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h
" |
| 45 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 class ExecutionContext; | 50 class ExecutionContext; |
| 50 class WebServiceWorker; | 51 class WebServiceWorker; |
| 51 class WebServiceWorkerProvider; | 52 class WebServiceWorkerProvider; |
| 52 class WebServiceWorkerRegistration; | 53 class WebServiceWorkerRegistration; |
| 53 | 54 |
| 54 class MODULES_EXPORT ServiceWorkerContainer final | 55 class MODULES_EXPORT ServiceWorkerContainer final |
| 55 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerCo
ntainer> | 56 : public RefCountedGarbageCollectedEventTargetWithInlineData<ServiceWorkerCo
ntainer> |
| 56 , public ContextLifecycleObserver | 57 , public ContextLifecycleObserver |
| 57 , public WebServiceWorkerProviderClient { | 58 , public WebServiceWorkerProviderClient { |
| 58 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
| 59 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerContainer); | 60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(ServiceWorkerContainer); |
| 60 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ServiceWorkerContainer); |
| 61 public: | 62 public: |
| 63 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; |
| 64 |
| 62 static ServiceWorkerContainer* create(ExecutionContext*); | 65 static ServiceWorkerContainer* create(ExecutionContext*); |
| 63 ~ServiceWorkerContainer(); | 66 ~ServiceWorkerContainer(); |
| 64 | 67 |
| 65 void willBeDetachedFromFrame(); | 68 void willBeDetachedFromFrame(); |
| 66 | 69 |
| 67 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 68 | 71 |
| 69 ServiceWorker* controller() { return m_controller; } | 72 ServiceWorker* controller() { return m_controller; } |
| 70 ScriptPromise ready(ScriptState*); | 73 ScriptPromise ready(ScriptState*); |
| 71 WebServiceWorkerProvider* provider() { return m_provider; } | 74 WebServiceWorkerProvider* provider() { return m_provider; } |
| 72 | 75 |
| 76 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, PassOwnPtr<RegistrationCallbacks>); |
| 77 |
| 73 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); | 78 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); |
| 74 ScriptPromise getRegistration(ScriptState*, const String& documentURL); | 79 ScriptPromise getRegistration(ScriptState*, const String& documentURL); |
| 75 ScriptPromise getRegistrations(ScriptState*); | 80 ScriptPromise getRegistrations(ScriptState*); |
| 76 | 81 |
| 77 // WebServiceWorkerProviderClient overrides. | 82 // WebServiceWorkerProviderClient overrides. |
| 78 void setController(WebPassOwnPtr<WebServiceWorker::Handle>, bool shouldNotif
yControllerChange) override; | 83 void setController(WebPassOwnPtr<WebServiceWorker::Handle>, bool shouldNotif
yControllerChange) override; |
| 79 void dispatchMessageEvent(WebPassOwnPtr<WebServiceWorker::Handle>, const Web
String& message, const WebMessagePortChannelArray&) override; | 84 void dispatchMessageEvent(WebPassOwnPtr<WebServiceWorker::Handle>, const Web
String& message, const WebMessagePortChannelArray&) override; |
| 80 | 85 |
| 81 // EventTarget overrides. | 86 // EventTarget overrides. |
| 82 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } | 87 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 ReadyProperty* createReadyProperty(); | 98 ReadyProperty* createReadyProperty(); |
| 94 | 99 |
| 95 WebServiceWorkerProvider* m_provider; | 100 WebServiceWorkerProvider* m_provider; |
| 96 Member<ServiceWorker> m_controller; | 101 Member<ServiceWorker> m_controller; |
| 97 Member<ReadyProperty> m_ready; | 102 Member<ReadyProperty> m_ready; |
| 98 }; | 103 }; |
| 99 | 104 |
| 100 } // namespace blink | 105 } // namespace blink |
| 101 | 106 |
| 102 #endif // ServiceWorkerContainer_h | 107 #endif // ServiceWorkerContainer_h |
| OLD | NEW |