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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 startWorkerThread(); | 324 startWorkerThread(); |
325 } | 325 } |
326 | 326 |
327 void WebEmbeddedWorkerImpl::startWorkerThread() | 327 void WebEmbeddedWorkerImpl::startWorkerThread() |
328 { | 328 { |
329 ASSERT(!m_askedToTerminate); | 329 ASSERT(!m_askedToTerminate); |
330 | 330 |
331 Document* document = m_mainFrame->frame()->document(); | 331 Document* document = m_mainFrame->frame()->document(); |
332 | 332 |
| 333 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; |
| 334 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) |
| 335 startMode = PauseWorkerGlobalScopeOnStart; |
| 336 |
333 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 337 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
334 SecurityOrigin* starterOrigin = document->securityOrigin(); | 338 SecurityOrigin* starterOrigin = document->securityOrigin(); |
335 | 339 |
336 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 340 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
337 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC
lient.release()); | 341 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC
lient.release()); |
338 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 342 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); |
339 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); | 343 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); |
340 | 344 |
341 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 345 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
342 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 346 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
343 | 347 |
344 KURL scriptURL = m_mainScriptLoader->url(); | 348 KURL scriptURL = m_mainScriptLoader->url(); |
345 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); | |
346 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( | 349 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( |
347 scriptURL, | 350 scriptURL, |
348 m_workerStartData.userAgent, | 351 m_workerStartData.userAgent, |
349 m_mainScriptLoader->script(), | 352 m_mainScriptLoader->script(), |
350 m_mainScriptLoader->releaseCachedMetadata(), | 353 m_mainScriptLoader->releaseCachedMetadata(), |
351 startMode, | 354 startMode, |
352 document->contentSecurityPolicy()->headers(), | 355 document->contentSecurityPolicy()->headers(), |
353 starterOrigin, | 356 starterOrigin, |
354 workerClients.release(), | 357 workerClients.release(), |
355 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 358 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); |
356 | 359 |
357 m_mainScriptLoader.clear(); | 360 m_mainScriptLoader.clear(); |
358 | 361 |
359 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 362 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
360 m_loaderProxy = WorkerLoaderProxy::create(this); | 363 m_loaderProxy = WorkerLoaderProxy::create(this); |
361 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 364 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
362 m_workerThread->start(startupData.release()); | 365 m_workerThread->start(startupData.release()); |
363 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 366 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
364 } | 367 } |
365 | 368 |
366 } // namespace blink | 369 } // namespace blink |
OLD | NEW |