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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
68 #include "public/web/WebSerializedScriptValue.h" | 68 #include "public/web/WebSerializedScriptValue.h" |
69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
70 #include "web/WebEmbeddedWorkerImpl.h" | 70 #include "web/WebEmbeddedWorkerImpl.h" |
71 #include "wtf/Assertions.h" | 71 #include "wtf/Assertions.h" |
72 #include "wtf/Functional.h" | 72 #include "wtf/Functional.h" |
73 #include "wtf/PassOwnPtr.h" | 73 #include "wtf/PassOwnPtr.h" |
74 | 74 |
75 namespace blink { | 75 namespace blink { |
76 | 76 |
77 PassOwnPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopeProxy::create(
WebEmbeddedWorkerImpl& embeddedWorker, Document& document, WebServiceWorkerConte
xtClient& client) | 77 PassOwnPtrWillBeRawPtr<ServiceWorkerGlobalScopeProxy> ServiceWorkerGlobalScopePr
oxy::create(WebEmbeddedWorkerImpl& embeddedWorker, Document& document, WebServic
eWorkerContextClient& client) |
78 { | 78 { |
79 return adoptPtr(new ServiceWorkerGlobalScopeProxy(embeddedWorker, document,
client)); | 79 return adoptPtrWillBeNoop(new ServiceWorkerGlobalScopeProxy(embeddedWorker,
document, client)); |
80 } | 80 } |
81 | 81 |
82 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() | 82 ServiceWorkerGlobalScopeProxy::~ServiceWorkerGlobalScopeProxy() |
83 { | 83 { |
| 84 // Verify that the proxy has been detached. |
| 85 ASSERT(!m_embeddedWorker); |
| 86 } |
| 87 |
| 88 DEFINE_TRACE(ServiceWorkerGlobalScopeProxy) |
| 89 { |
| 90 visitor->trace(m_document); |
| 91 visitor->trace(m_workerGlobalScope); |
84 } | 92 } |
85 | 93 |
86 void ServiceWorkerGlobalScopeProxy::setRegistration(WebPassOwnPtr<WebServiceWork
erRegistration::Handle> handle) | 94 void ServiceWorkerGlobalScopeProxy::setRegistration(WebPassOwnPtr<WebServiceWork
erRegistration::Handle> handle) |
87 { | 95 { |
88 ASSERT(m_workerGlobalScope); | 96 workerGlobalScope()->setRegistration(handle); |
89 m_workerGlobalScope->setRegistration(handle); | |
90 } | 97 } |
91 | 98 |
92 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) | 99 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) |
93 { | 100 { |
94 ASSERT(m_workerGlobalScope); | 101 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Activate, eventID); |
95 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Activate, eventID); | |
96 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); | 102 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); |
97 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 103 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
98 } | 104 } |
99 | 105 |
100 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 106 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
101 { | 107 { |
102 ASSERT(m_workerGlobalScope); | 108 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop
e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); |
103 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc
ope, eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe
quest.requestContext()); | |
104 bool defaultPrevented = false; | 109 bool defaultPrevented = false; |
105 Request* request = Request::create(m_workerGlobalScope, webRequest); | 110 Request* request = Request::create(workerGlobalScope(), webRequest); |
106 request->headers()->setGuard(Headers::ImmutableGuard); | 111 request->headers()->setGuard(Headers::ImmutableGuard); |
107 FetchEventInit eventInit; | 112 FetchEventInit eventInit; |
108 eventInit.setCancelable(true); | 113 eventInit.setCancelable(true); |
109 eventInit.setRequest(request); | 114 eventInit.setRequest(request); |
110 eventInit.setIsReload(webRequest.isReload()); | 115 eventInit.setIsReload(webRequest.isReload()); |
111 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames:
:fetch, eventInit, observer)); | 116 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames:
:fetch, eventInit, observer)); |
112 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release())
; | 117 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; |
113 observer->didDispatchEvent(defaultPrevented); | 118 observer->didDispatchEvent(defaultPrevented); |
114 } | 119 } |
115 | 120 |
116 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | 121 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) |
117 { | 122 { |
118 ASSERT(m_workerGlobalScope); | |
119 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 123 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
120 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | 124 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); |
121 } | 125 } |
122 | 126 |
123 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 127 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
124 { | 128 { |
125 ASSERT(m_workerGlobalScope); | 129 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
126 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Install, eventID); | |
127 RefPtrWillBeRawPtr<Event> event; | 130 RefPtrWillBeRawPtr<Event> event; |
128 if (RuntimeEnabledFeatures::foreignFetchEnabled()) { | 131 if (RuntimeEnabledFeatures::foreignFetchEnabled()) |
129 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 132 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
130 } else { | 133 else |
131 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | 134 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
132 } | 135 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
133 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | |
134 } | 136 } |
135 | 137 |
136 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) | 138 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) |
137 { | 139 { |
138 ASSERT(m_workerGlobalScope); | 140 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
139 | |
140 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | |
141 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 141 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
142 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports, value)); | 142 workerGlobalScope()->dispatchEvent(MessageEvent::create(ports, value)); |
143 } | 143 } |
144 | 144 |
145 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) | 145 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) |
146 { | 146 { |
147 ASSERT(m_workerGlobalScope); | 147 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); |
148 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::NotificationClick, eventID); | |
149 NotificationEventInit eventInit; | 148 NotificationEventInit eventInit; |
150 eventInit.setNotification(Notification::create(m_workerGlobalScope, notifica
tionID, data)); | 149 eventInit.setNotification(Notification::create(workerGlobalScope(), notifica
tionID, data)); |
151 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) | 150 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) |
152 eventInit.setAction(data.actions[actionIndex].action); | 151 eventInit.setAction(data.actions[actionIndex].action); |
153 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); | 152 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); |
154 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 153 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
155 } | 154 } |
156 | 155 |
157 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 156 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
158 { | 157 { |
159 ASSERT(m_workerGlobalScope); | 158 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Push, eventID); |
160 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); | |
161 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); | 159 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); |
162 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 160 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
163 } | 161 } |
164 | 162 |
165 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 163 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
166 { | 164 { |
167 ASSERT(m_workerGlobalScope); | |
168 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 165 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
169 ServicePortCollection* collection = WorkerNavigatorServices::services(m_work
erGlobalScope, *m_workerGlobalScope->navigator()); | 166 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); |
170 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 167 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
171 } | 168 } |
172 | 169 |
173 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) | 170 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) |
174 { | 171 { |
175 ASSERT(m_workerGlobalScope); | |
176 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 172 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
177 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 173 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
178 return; | 174 return; |
179 } | 175 } |
180 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); | 176 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); |
181 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi
stration.tag, lastChance == IsLastChance, observer)); | 177 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi
stration.tag, lastChance == IsLastChance, observer)); |
182 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 178 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
183 } | 179 } |
184 | 180 |
185 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 181 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
186 { | 182 { |
187 ASSERT(m_workerGlobalScope); | 183 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
188 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | |
189 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 184 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
190 // FIXME: Have proper source for this MessageEvent. | 185 // FIXME: Have proper source for this MessageEvent. |
191 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 186 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); |
192 event->setType(EventTypeNames::crossoriginmessage); | 187 event->setType(EventTypeNames::crossoriginmessage); |
193 m_workerGlobalScope->dispatchEvent(event); | 188 workerGlobalScope()->dispatchEvent(event); |
194 } | 189 } |
195 | 190 |
196 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL, int) | 191 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL, int) |
197 { | 192 { |
198 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); | 193 client().reportException(errorMessage, lineNumber, columnNumber, sourceURL); |
199 } | 194 } |
200 | 195 |
201 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr<
ConsoleMessage> consoleMessage) | 196 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(PassRefPtrWillBeRawPtr<
ConsoleMessage> consoleMessage) |
202 { | 197 { |
203 m_client.reportConsoleMessage(consoleMessage->source(), consoleMessage->leve
l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur
l()); | 198 client().reportConsoleMessage(consoleMessage->source(), consoleMessage->leve
l(), consoleMessage->message(), consoleMessage->lineNumber(), consoleMessage->ur
l()); |
204 } | 199 } |
205 | 200 |
206 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) | 201 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) |
207 { | 202 { |
208 m_document.postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, &m_embeddedWorker, message)); | 203 ASSERT(m_embeddedWorker); |
| 204 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, m_embeddedWorker, message)); |
209 } | 205 } |
210 | 206 |
211 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) | 207 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) |
212 { | 208 { |
213 m_client.didEvaluateWorkerScript(success); | 209 client().didEvaluateWorkerScript(success); |
214 } | 210 } |
215 | 211 |
216 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() | 212 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() |
217 { | 213 { |
218 ASSERT(m_workerGlobalScope); | 214 ScriptState::Scope scope(workerGlobalScope()->script()->scriptState()); |
219 ScriptState::Scope scope(m_workerGlobalScope->script()->scriptState()); | 215 client().didInitializeWorkerContext(workerGlobalScope()->script()->context()
, WebURL(m_documentURL)); |
220 m_client.didInitializeWorkerContext(m_workerGlobalScope->script()->context()
, WebURL(m_documentURL)); | |
221 } | 216 } |
222 | 217 |
223 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) | 218 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) |
224 { | 219 { |
225 ASSERT(!m_workerGlobalScope); | 220 ASSERT(!m_workerGlobalScope); |
226 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); | 221 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); |
227 m_client.workerContextStarted(this); | 222 client().workerContextStarted(this); |
228 } | 223 } |
229 | 224 |
230 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() | 225 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() |
231 { | 226 { |
232 m_document.postTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorke
rImpl::terminateWorkerContext, &m_embeddedWorker)); | 227 ASSERT(m_embeddedWorker); |
| 228 document().postTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorke
rImpl::terminateWorkerContext, m_embeddedWorker)); |
233 } | 229 } |
234 | 230 |
235 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() | 231 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() |
236 { | 232 { |
237 v8::HandleScope handleScope(m_workerGlobalScope->thread()->isolate()); | 233 v8::HandleScope handleScope(workerGlobalScope()->thread()->isolate()); |
238 m_client.willDestroyWorkerContext(m_workerGlobalScope->script()->context()); | 234 client().willDestroyWorkerContext(workerGlobalScope()->script()->context()); |
239 m_workerGlobalScope = nullptr; | 235 m_workerGlobalScope = nullptr; |
240 } | 236 } |
241 | 237 |
242 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() | 238 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() |
243 { | 239 { |
244 m_client.workerContextDestroyed(); | 240 client().workerContextDestroyed(); |
245 } | 241 } |
246 | 242 |
247 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 243 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
248 : m_embeddedWorker(embeddedWorker) | 244 : m_embeddedWorker(&embeddedWorker) |
249 , m_document(document) | 245 , m_document(&document) |
250 , m_documentURL(document.url().copy()) | 246 , m_documentURL(document.url().copy()) |
251 , m_client(client) | 247 , m_client(&client) |
252 , m_workerGlobalScope(nullptr) | 248 , m_workerGlobalScope(nullptr) |
253 { | 249 { |
254 } | 250 } |
255 | 251 |
| 252 void ServiceWorkerGlobalScopeProxy::detach() |
| 253 { |
| 254 m_embeddedWorker = nullptr; |
| 255 m_document = nullptr; |
| 256 m_client = nullptr; |
| 257 m_workerGlobalScope = nullptr; |
| 258 } |
| 259 |
| 260 WebServiceWorkerContextClient& ServiceWorkerGlobalScopeProxy::client() const |
| 261 { |
| 262 ASSERT(m_client); |
| 263 return *m_client; |
| 264 } |
| 265 |
| 266 Document& ServiceWorkerGlobalScopeProxy::document() const |
| 267 { |
| 268 ASSERT(m_document); |
| 269 return *m_document; |
| 270 } |
| 271 |
| 272 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
| 273 { |
| 274 ASSERT(m_workerGlobalScope); |
| 275 return m_workerGlobalScope; |
| 276 } |
| 277 |
256 } // namespace blink | 278 } // namespace blink |
OLD | NEW |