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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) | 197 void ServiceWorkerGlobalScopeProxy::postMessageToPageInspector(const String& mes
sage) |
198 { | 198 { |
199 m_document.postInspectorTask(FROM_HERE, createCrossThreadTask(&WebEmbeddedWo
rkerImpl::postMessageToPageInspector, &m_embeddedWorker, message)); | 199 m_document.postInspectorTask(FROM_HERE, createCrossThreadTask(&WebEmbeddedWo
rkerImpl::postMessageToPageInspector, &m_embeddedWorker, message)); |
200 } | 200 } |
201 | 201 |
202 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) | 202 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) |
203 { | 203 { |
204 m_client.didEvaluateWorkerScript(success); | 204 m_client.didEvaluateWorkerScript(success); |
205 } | 205 } |
206 | 206 |
| 207 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() |
| 208 { |
| 209 ASSERT(m_workerGlobalScope); |
| 210 ScriptState::Scope scope(m_workerGlobalScope->script()->scriptState()); |
| 211 m_client.didInitializeWorkerContext(m_workerGlobalScope->script()->context()
, WebURL(m_documentURL)); |
| 212 } |
| 213 |
207 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) | 214 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerGlobalScope*
workerGlobalScope) |
208 { | 215 { |
209 ASSERT(!m_workerGlobalScope); | 216 ASSERT(!m_workerGlobalScope); |
210 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); | 217 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); |
211 m_client.workerContextStarted(this); | 218 m_client.workerContextStarted(this); |
212 } | 219 } |
213 | 220 |
214 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() | 221 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() |
215 { | 222 { |
216 m_document.postTask(FROM_HERE, createCrossThreadTask(&WebEmbeddedWorkerImpl:
:terminateWorkerContext, &m_embeddedWorker)); | 223 m_document.postTask(FROM_HERE, createCrossThreadTask(&WebEmbeddedWorkerImpl:
:terminateWorkerContext, &m_embeddedWorker)); |
217 } | 224 } |
218 | 225 |
219 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() | 226 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() |
220 { | 227 { |
221 m_workerGlobalScope = nullptr; | 228 m_workerGlobalScope = nullptr; |
222 m_client.willDestroyWorkerContext(); | 229 m_client.willDestroyWorkerContext(); |
223 } | 230 } |
224 | 231 |
225 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() | 232 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() |
226 { | 233 { |
227 m_client.workerContextDestroyed(); | 234 m_client.workerContextDestroyed(); |
228 } | 235 } |
229 | 236 |
230 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 237 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
231 : m_embeddedWorker(embeddedWorker) | 238 : m_embeddedWorker(embeddedWorker) |
232 , m_document(document) | 239 , m_document(document) |
| 240 , m_documentURL(document.url().copy()) |
233 , m_client(client) | 241 , m_client(client) |
234 , m_workerGlobalScope(nullptr) | 242 , m_workerGlobalScope(nullptr) |
235 { | 243 { |
236 } | 244 } |
237 | 245 |
238 } // namespace blink | 246 } // namespace blink |
OLD | NEW |