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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK(m_embeddedWorker); | 257 DCHECK(m_embeddedWorker); |
258 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, crossThreadUnretained(m_embeddedWork
er), message)); | 258 document().postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&WebEmbe
ddedWorkerImpl::postMessageToPageInspector, crossThreadUnretained(m_embeddedWork
er), message)); |
259 } | 259 } |
260 | 260 |
261 void ServiceWorkerGlobalScopeProxy::didLoadWorkerScript(size_t scriptSize, size_
t cachedMetadataSize) | 261 void ServiceWorkerGlobalScopeProxy::didLoadWorkerScript(size_t scriptSize, size_
t cachedMetadataSize) |
262 { | 262 { |
263 DCHECK(m_workerGlobalScope); | 263 DCHECK(m_workerGlobalScope); |
264 m_workerGlobalScope->didLoadWorkerScript(scriptSize, cachedMetadataSize); | 264 m_workerGlobalScope->didLoadWorkerScript(scriptSize, cachedMetadataSize); |
265 } | 265 } |
266 | 266 |
267 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) | 267 void ServiceWorkerGlobalScopeProxy::didCreateWorkerGlobalScope(WorkerOrWorkletGl
obalScope* workerGlobalScope) |
268 { | 268 { |
269 DCHECK(m_workerGlobalScope); | 269 DCHECK(!m_workerGlobalScope); |
270 m_workerGlobalScope->didEvaluateWorkerScript(); | 270 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); |
271 client().didEvaluateWorkerScript(success); | 271 client().workerContextStarted(this); |
272 } | 272 } |
273 | 273 |
274 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() | 274 void ServiceWorkerGlobalScopeProxy::didInitializeWorkerContext() |
275 { | 275 { |
276 ScriptState::Scope scope(workerGlobalScope()->scriptController()->getScriptS
tate()); | 276 ScriptState::Scope scope(workerGlobalScope()->scriptController()->getScriptS
tate()); |
277 client().didInitializeWorkerContext(workerGlobalScope()->scriptController()-
>context()); | 277 client().didInitializeWorkerContext(workerGlobalScope()->scriptController()-
>context()); |
278 } | 278 } |
279 | 279 |
280 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeStarted(WorkerOrWorkletGlob
alScope* workerGlobalScope) | 280 void ServiceWorkerGlobalScopeProxy::didEvaluateWorkerScript(bool success) |
281 { | 281 { |
282 DCHECK(!m_workerGlobalScope); | 282 DCHECK(m_workerGlobalScope); |
283 m_workerGlobalScope = static_cast<ServiceWorkerGlobalScope*>(workerGlobalSco
pe); | 283 m_workerGlobalScope->didEvaluateWorkerScript(); |
284 client().workerContextStarted(this); | 284 client().didEvaluateWorkerScript(success); |
285 } | 285 } |
286 | 286 |
287 void ServiceWorkerGlobalScopeProxy::workerGlobalScopeClosed() | 287 void ServiceWorkerGlobalScopeProxy::didCloseWorkerGlobalScope() |
288 { | 288 { |
289 // This should never be called because close() is not defined in | 289 // This should never be called because close() is not defined in |
290 // ServiceWorkerGlobalScope. | 290 // ServiceWorkerGlobalScope. |
291 NOTREACHED(); | 291 NOTREACHED(); |
292 } | 292 } |
293 | 293 |
294 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() | 294 void ServiceWorkerGlobalScopeProxy::willDestroyWorkerGlobalScope() |
295 { | 295 { |
296 v8::HandleScope handleScope(workerGlobalScope()->thread()->isolate()); | 296 v8::HandleScope handleScope(workerGlobalScope()->thread()->isolate()); |
297 client().willDestroyWorkerContext(workerGlobalScope()->scriptController()->c
ontext()); | 297 client().willDestroyWorkerContext(workerGlobalScope()->scriptController()->c
ontext()); |
298 m_workerGlobalScope = nullptr; | 298 m_workerGlobalScope = nullptr; |
299 } | 299 } |
300 | 300 |
301 void ServiceWorkerGlobalScopeProxy::workerThreadTerminated() | 301 void ServiceWorkerGlobalScopeProxy::didTerminateWorkerThread() |
302 { | 302 { |
303 client().workerContextDestroyed(); | 303 client().workerContextDestroyed(); |
304 } | 304 } |
305 | 305 |
306 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 306 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
307 : m_embeddedWorker(&embeddedWorker) | 307 : m_embeddedWorker(&embeddedWorker) |
308 , m_document(&document) | 308 , m_document(&document) |
309 , m_client(&client) | 309 , m_client(&client) |
310 , m_workerGlobalScope(nullptr) | 310 , m_workerGlobalScope(nullptr) |
311 { | 311 { |
(...skipping 19 matching lines...) Expand all Loading... |
331 return *m_document; | 331 return *m_document; |
332 } | 332 } |
333 | 333 |
334 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 334 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
335 { | 335 { |
336 DCHECK(m_workerGlobalScope); | 336 DCHECK(m_workerGlobalScope); |
337 return m_workerGlobalScope; | 337 return m_workerGlobalScope; |
338 } | 338 } |
339 | 339 |
340 } // namespace blink | 340 } // namespace blink |
OLD | NEW |