| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 408 } |
| 409 startWorkerThread(); | 409 startWorkerThread(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 void WebEmbeddedWorkerImpl::startWorkerThread() { | 412 void WebEmbeddedWorkerImpl::startWorkerThread() { |
| 413 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); | 413 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); |
| 414 DCHECK(!m_askedToTerminate); | 414 DCHECK(!m_askedToTerminate); |
| 415 | 415 |
| 416 Document* document = m_mainFrame->frame()->document(); | 416 Document* document = m_mainFrame->frame()->document(); |
| 417 | 417 |
| 418 // FIXME: this document's origin is pristine and without any extra privileges.
(crbug.com/254993) | 418 // FIXME: this document's origin is pristine and without any extra privileges. |
| 419 // (crbug.com/254993) |
| 419 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); | 420 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); |
| 420 | 421 |
| 421 WorkerClients* workerClients = WorkerClients::create(); | 422 WorkerClients* workerClients = WorkerClients::create(); |
| 422 provideContentSettingsClientToWorker(workerClients, | 423 provideContentSettingsClientToWorker(workerClients, |
| 423 std::move(m_contentSettingsClient)); | 424 std::move(m_contentSettingsClient)); |
| 424 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); | 425 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create()); |
| 425 provideServiceWorkerGlobalScopeClientToWorker( | 426 provideServiceWorkerGlobalScopeClientToWorker( |
| 426 workerClients, | 427 workerClients, |
| 427 ServiceWorkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 428 ServiceWorkerGlobalScopeClientImpl::create(*m_workerContextClient)); |
| 428 provideServiceWorkerContainerClientToWorker( | 429 provideServiceWorkerContainerClientToWorker( |
| 429 workerClients, | 430 workerClients, |
| 430 wrapUnique(m_workerContextClient->createServiceWorkerProvider())); | 431 wrapUnique(m_workerContextClient->createServiceWorkerProvider())); |
| 431 | 432 |
| 432 // We need to set the CSP to both the shadow page's document and the ServiceWo
rkerGlobalScope. | 433 // We need to set the CSP to both the shadow page's document and the |
| 434 // ServiceWorkerGlobalScope. |
| 433 document->initContentSecurityPolicy( | 435 document->initContentSecurityPolicy( |
| 434 m_mainScriptLoader->releaseContentSecurityPolicy()); | 436 m_mainScriptLoader->releaseContentSecurityPolicy()); |
| 435 if (!m_mainScriptLoader->referrerPolicy().isNull()) | 437 if (!m_mainScriptLoader->referrerPolicy().isNull()) |
| 436 document->parseAndSetReferrerPolicy(m_mainScriptLoader->referrerPolicy()); | 438 document->parseAndSetReferrerPolicy(m_mainScriptLoader->referrerPolicy()); |
| 437 | 439 |
| 438 KURL scriptURL = m_mainScriptLoader->url(); | 440 KURL scriptURL = m_mainScriptLoader->url(); |
| 439 WorkerThreadStartMode startMode = | 441 WorkerThreadStartMode startMode = |
| 440 m_workerInspectorProxy->workerStartMode(document); | 442 m_workerInspectorProxy->workerStartMode(document); |
| 441 std::unique_ptr<WorkerSettings> workerSettings = | 443 std::unique_ptr<WorkerSettings> workerSettings = |
| 442 wrapUnique(new WorkerSettings(document->settings())); | 444 wrapUnique(new WorkerSettings(document->settings())); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 463 *this, *document, *m_workerContextClient); | 465 *this, *document, *m_workerContextClient); |
| 464 m_loaderProxy = WorkerLoaderProxy::create(this); | 466 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 465 m_workerThread = | 467 m_workerThread = |
| 466 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); | 468 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); |
| 467 m_workerThread->start(std::move(startupData)); | 469 m_workerThread->start(std::move(startupData)); |
| 468 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), | 470 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), |
| 469 scriptURL); | 471 scriptURL); |
| 470 } | 472 } |
| 471 | 473 |
| 472 } // namespace blink | 474 } // namespace blink |
| OLD | NEW |