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 20 matching lines...) Expand all Loading... |
31 #include "web/ServiceWorkerGlobalScopeProxy.h" | 31 #include "web/ServiceWorkerGlobalScopeProxy.h" |
32 | 32 |
33 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 33 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
34 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
37 #include "core/dom/MessagePort.h" | 37 #include "core/dom/MessagePort.h" |
38 #include "core/events/MessageEvent.h" | 38 #include "core/events/MessageEvent.h" |
39 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
40 #include "core/workers/WorkerGlobalScope.h" | 40 #include "core/workers/WorkerGlobalScope.h" |
41 #include "core/workers/WorkerThread.h" | 41 #include "core/workers/WorkerScript.h" |
42 #include "modules/background_sync/SyncEvent.h" | 42 #include "modules/background_sync/SyncEvent.h" |
43 #include "modules/fetch/Headers.h" | 43 #include "modules/fetch/Headers.h" |
44 #include "modules/geofencing/CircularGeofencingRegion.h" | 44 #include "modules/geofencing/CircularGeofencingRegion.h" |
45 #include "modules/geofencing/GeofencingEvent.h" | 45 #include "modules/geofencing/GeofencingEvent.h" |
46 #include "modules/navigatorconnect/AcceptConnectionObserver.h" | 46 #include "modules/navigatorconnect/AcceptConnectionObserver.h" |
47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" | 47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" |
48 #include "modules/navigatorconnect/ServicePortCollection.h" | 48 #include "modules/navigatorconnect/ServicePortCollection.h" |
49 #include "modules/navigatorconnect/WorkerNavigatorServices.h" | 49 #include "modules/navigatorconnect/WorkerNavigatorServices.h" |
50 #include "modules/notifications/Notification.h" | 50 #include "modules/notifications/Notification.h" |
51 #include "modules/notifications/NotificationEvent.h" | 51 #include "modules/notifications/NotificationEvent.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() | 244 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() |
245 { | 245 { |
246 ASSERT(m_embeddedWorker); | 246 ASSERT(m_embeddedWorker); |
247 document().postTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorke
rImpl::terminateWorkerContext, m_embeddedWorker)); | 247 document().postTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbeddedWorke
rImpl::terminateWorkerContext, m_embeddedWorker)); |
248 } | 248 } |
249 | 249 |
250 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() | 250 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() |
251 { | 251 { |
252 v8::HandleScope handleScope(workerGlobalScope()->thread()->isolate()); | 252 v8::HandleScope handleScope(workerGlobalScope()->workerScript()->isolate()); |
253 client().willDestroyWorkerContext(workerGlobalScope()->scriptController()->c
ontext()); | 253 client().willDestroyWorkerContext(workerGlobalScope()->scriptController()->c
ontext()); |
254 m_workerGlobalScope = nullptr; | 254 m_workerGlobalScope = nullptr; |
255 } | 255 } |
256 | 256 |
257 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() | 257 void ServiceWorkerGlobalScopeProxy::workerScriptTerminated() |
258 { | 258 { |
259 client().workerContextDestroyed(); | 259 client().workerContextDestroyed(); |
260 } | 260 } |
261 | 261 |
262 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 262 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
263 : m_embeddedWorker(&embeddedWorker) | 263 : m_embeddedWorker(&embeddedWorker) |
264 , m_document(&document) | 264 , m_document(&document) |
265 , m_documentURL(document.url().copy()) | 265 , m_documentURL(document.url().copy()) |
266 , m_client(&client) | 266 , m_client(&client) |
267 , m_workerGlobalScope(nullptr) | 267 , m_workerGlobalScope(nullptr) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 eventInit.setCancelable(true); | 304 eventInit.setCancelable(true); |
305 eventInit.setRequest(request); | 305 eventInit.setRequest(request); |
306 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 306 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
307 eventInit.setIsReload(webRequest.isReload()); | 307 eventInit.setIsReload(webRequest.isReload()); |
308 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 308 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); |
309 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; | 309 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; |
310 observer->didDispatchEvent(defaultPrevented); | 310 observer->didDispatchEvent(defaultPrevented); |
311 } | 311 } |
312 | 312 |
313 } // namespace blink | 313 } // namespace blink |
OLD | NEW |