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 26 matching lines...) Expand all Loading... |
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/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 | 48 |
48 namespace blink { | 49 namespace blink { |
49 | 50 |
50 class ExecutionContext; | 51 class ExecutionContext; |
51 class WebServiceWorker; | 52 class WebServiceWorker; |
52 class WebServiceWorkerProvider; | 53 class WebServiceWorkerProvider; |
53 class WebServiceWorkerRegistration; | 54 class WebServiceWorkerRegistration; |
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 public: | 62 public: |
62 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; | 63 using RegistrationCallbacks = WebServiceWorkerProvider::WebServiceWorkerRegi
strationCallbacks; |
63 | 64 |
64 static ServiceWorkerContainer* create(ExecutionContext*); | 65 static ServiceWorkerContainer* create(ExecutionContext*); |
65 ~ServiceWorkerContainer(); | 66 ~ServiceWorkerContainer(); |
66 | 67 |
67 void willBeDetachedFromFrame(); | 68 void willBeDetachedFromFrame(); |
68 | 69 |
69 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
70 | 71 |
71 ServiceWorker* controller() { return m_controller; } | 72 ServiceWorker* controller() { return m_controller; } |
72 ScriptPromise ready(ScriptState*); | 73 ScriptPromise ready(ScriptState*); |
73 WebServiceWorkerProvider* provider() { return m_provider; } | 74 WebServiceWorkerProvider* provider() { return m_provider; } |
74 | 75 |
75 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, PassOwnPtr<RegistrationCallbacks>); | 76 void registerServiceWorkerImpl(ExecutionContext*, const KURL& scriptURL, con
st KURL& scope, std::unique_ptr<RegistrationCallbacks>); |
76 | 77 |
77 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); | 78 ScriptPromise registerServiceWorker(ScriptState*, const String& pattern, con
st RegistrationOptions&); |
78 ScriptPromise getRegistration(ScriptState*, const String& documentURL); | 79 ScriptPromise getRegistration(ScriptState*, const String& documentURL); |
79 ScriptPromise getRegistrations(ScriptState*); | 80 ScriptPromise getRegistrations(ScriptState*); |
80 | 81 |
81 // WebServiceWorkerProviderClient overrides. | 82 // WebServiceWorkerProviderClient overrides. |
82 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; | 83 void setController(std::unique_ptr<WebServiceWorker::Handle>, bool shouldNot
ifyControllerChange) override; |
83 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; |
84 | 85 |
85 // EventTarget overrides. | 86 // EventTarget overrides. |
(...skipping 11 matching lines...) Expand all Loading... |
97 ReadyProperty* createReadyProperty(); | 98 ReadyProperty* createReadyProperty(); |
98 | 99 |
99 WebServiceWorkerProvider* m_provider; | 100 WebServiceWorkerProvider* m_provider; |
100 Member<ServiceWorker> m_controller; | 101 Member<ServiceWorker> m_controller; |
101 Member<ReadyProperty> m_ready; | 102 Member<ReadyProperty> m_ready; |
102 }; | 103 }; |
103 | 104 |
104 } // namespace blink | 105 } // namespace blink |
105 | 106 |
106 #endif // ServiceWorkerContainer_h | 107 #endif // ServiceWorkerContainer_h |
OLD | NEW |