| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, m_embeddedWorker, message)); | 223 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, m_embeddedWorker, message)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) | 226 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) |
| 227 { | 227 { |
| 228 client().didEvaluateWorkerScript(success); | 228 client().didEvaluateWorkerScript(success); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() | 231 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() |
| 232 { | 232 { |
| 233 ScriptState::Scope scope(workerGlobalScope()->script()->scriptState()); | 233 ScriptState::Scope scope(workerGlobalScope()->scriptController()->scriptStat
e()); |
| 234 client().didInitializeWorkerContext(workerGlobalScope()->script()->context()
, WebURL(m_documentURL)); | 234 client().didInitializeWorkerContext(workerGlobalScope()->scriptController()-
>context(), WebURL(m_documentURL)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) | 237 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) |
| 238 { | 238 { |
| 239 ASSERT(!m_workerGlobalScope); | 239 ASSERT(!m_workerGlobalScope); |
| 240 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); | 240 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); |
| 241 client().workerContextStarted(this); | 241 client().workerContextStarted(this); |
| 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()->thread()->isolate()); |
| 253 client().willDestroyWorkerContext(workerGlobalScope()->script()->context()); | 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::workerThreadTerminated() |
| 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) |
| (...skipping 40 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 |