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