| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 54 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
| 55 #include "public/platform/Platform.h" | 55 #include "public/platform/Platform.h" |
| 56 #include "public/platform/WebURLRequest.h" | 56 #include "public/platform/WebURLRequest.h" |
| 57 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 57 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
| 58 #include "public/web/WebDevToolsAgent.h" | 58 #include "public/web/WebDevToolsAgent.h" |
| 59 #include "public/web/WebSettings.h" | 59 #include "public/web/WebSettings.h" |
| 60 #include "public/web/WebView.h" | 60 #include "public/web/WebView.h" |
| 61 #include "public/web/WebWorkerContentSettingsClientProxy.h" | 61 #include "public/web/WebWorkerContentSettingsClientProxy.h" |
| 62 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 62 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 63 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" | 63 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" |
| 64 #include "web/IndexedDBClientImpl.h" |
| 64 #include "web/ServiceWorkerGlobalScopeClientImpl.h" | 65 #include "web/ServiceWorkerGlobalScopeClientImpl.h" |
| 65 #include "web/ServiceWorkerGlobalScopeProxy.h" | 66 #include "web/ServiceWorkerGlobalScopeProxy.h" |
| 66 #include "web/WebDataSourceImpl.h" | 67 #include "web/WebDataSourceImpl.h" |
| 67 #include "web/WebLocalFrameImpl.h" | 68 #include "web/WebLocalFrameImpl.h" |
| 68 #include "web/WorkerContentSettingsClient.h" | 69 #include "web/WorkerContentSettingsClient.h" |
| 69 #include "wtf/Functional.h" | 70 #include "wtf/Functional.h" |
| 70 | 71 |
| 71 namespace blink { | 72 namespace blink { |
| 72 | 73 |
| 73 WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* clie
nt, WebWorkerContentSettingsClientProxy* contentSettingsClient) | 74 WebEmbeddedWorker* WebEmbeddedWorker::create(WebServiceWorkerContextClient* clie
nt, WebWorkerContentSettingsClientProxy* contentSettingsClient) |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); | 344 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); |
| 344 DCHECK(!m_askedToTerminate); | 345 DCHECK(!m_askedToTerminate); |
| 345 | 346 |
| 346 Document* document = m_mainFrame->frame()->document(); | 347 Document* document = m_mainFrame->frame()->document(); |
| 347 | 348 |
| 348 // 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) |
| 349 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); | 350 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); |
| 350 | 351 |
| 351 WorkerClients* workerClients = WorkerClients::create(); | 352 WorkerClients* workerClients = WorkerClients::create(); |
| 352 provideContentSettingsClientToWorker(workerClients, m_contentSettingsClient.
release()); | 353 provideContentSettingsClientToWorker(workerClients, m_contentSettingsClient.
release()); |
| 354 provideIndexedDBClientToWorker(workerClients, IndexedDBClientImpl::create())
; |
| 353 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); | 355 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); |
| 354 provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_worker
ContextClient->createServiceWorkerProvider())); | 356 provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_worker
ContextClient->createServiceWorkerProvider())); |
| 355 | 357 |
| 356 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 358 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
| 357 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 359 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
| 358 | 360 |
| 359 KURL scriptURL = m_mainScriptLoader->url(); | 361 KURL scriptURL = m_mainScriptLoader->url(); |
| 360 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); | 362 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); |
| 361 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( | 363 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( |
| 362 scriptURL, | 364 scriptURL, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 373 m_mainScriptLoader.clear(); | 375 m_mainScriptLoader.clear(); |
| 374 | 376 |
| 375 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 377 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 376 m_loaderProxy = WorkerLoaderProxy::create(this); | 378 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 377 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 379 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
| 378 m_workerThread->start(startupData.release()); | 380 m_workerThread->start(startupData.release()); |
| 379 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 381 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 380 } | 382 } |
| 381 | 383 |
| 382 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |