| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 { | 390 { |
| 391 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); | 391 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); |
| 392 DCHECK(!m_askedToTerminate); | 392 DCHECK(!m_askedToTerminate); |
| 393 | 393 |
| 394 Document* document = m_mainFrame->frame()->document(); | 394 Document* document = m_mainFrame->frame()->document(); |
| 395 | 395 |
| 396 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 396 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
| 397 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); | 397 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); |
| 398 | 398 |
| 399 WorkerClients* workerClients = WorkerClients::create(); | 399 WorkerClients* workerClients = WorkerClients::create(); |
| 400 provideContentSettingsClientToWorker(workerClients, m_contentSettingsClient.
release()); | 400 provideContentSettingsClientToWorker(workerClients, std::move(m_contentSetti
ngsClient)); |
| 401 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create())
; | 401 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create())
; |
| 402 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); | 402 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); |
| 403 provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_worker
ContextClient->createServiceWorkerProvider())); | 403 provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_worker
ContextClient->createServiceWorkerProvider())); |
| 404 | 404 |
| 405 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 405 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
| 406 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 406 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
| 407 | 407 |
| 408 KURL scriptURL = m_mainScriptLoader->url(); | 408 KURL scriptURL = m_mainScriptLoader->url(); |
| 409 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); | 409 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); |
| 410 | 410 |
| 411 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( | 411 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( |
| 412 scriptURL, | 412 scriptURL, |
| 413 m_workerStartData.userAgent, | 413 m_workerStartData.userAgent, |
| 414 m_mainScriptLoader->script(), | 414 m_mainScriptLoader->script(), |
| 415 m_mainScriptLoader->releaseCachedMetadata(), | 415 m_mainScriptLoader->releaseCachedMetadata(), |
| 416 startMode, | 416 startMode, |
| 417 document->contentSecurityPolicy()->headers().get(), | 417 document->contentSecurityPolicy()->headers().get(), |
| 418 starterOrigin, | 418 starterOrigin, |
| 419 workerClients, | 419 workerClients, |
| 420 m_mainScriptLoader->responseAddressSpace(), | 420 m_mainScriptLoader->responseAddressSpace(), |
| 421 m_mainScriptLoader->originTrialTokens(), | 421 m_mainScriptLoader->originTrialTokens(), |
| 422 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 422 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); |
| 423 | 423 |
| 424 m_mainScriptLoader.clear(); | 424 m_mainScriptLoader.clear(); |
| 425 | 425 |
| 426 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 426 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 427 m_loaderProxy = WorkerLoaderProxy::create(this); | 427 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 428 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 428 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
| 429 m_workerThread->start(startupData.release()); | 429 m_workerThread->start(std::move(startupData)); |
| 430 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 430 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace blink | 433 } // namespace blink |
| OLD | NEW |