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