| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/inspector/WorkerInspectorController.h" | 39 #include "core/inspector/WorkerInspectorController.h" |
| 40 #include "core/loader/FrameLoadRequest.h" | 40 #include "core/loader/FrameLoadRequest.h" |
| 41 #include "core/loader/SubstituteData.h" | 41 #include "core/loader/SubstituteData.h" |
| 42 #include "core/workers/WorkerClients.h" | 42 #include "core/workers/WorkerClients.h" |
| 43 #include "core/workers/WorkerGlobalScope.h" | 43 #include "core/workers/WorkerGlobalScope.h" |
| 44 #include "core/workers/WorkerInspectorProxy.h" | 44 #include "core/workers/WorkerInspectorProxy.h" |
| 45 #include "core/workers/WorkerLoaderProxy.h" | 45 #include "core/workers/WorkerLoaderProxy.h" |
| 46 #include "core/workers/WorkerScriptLoader.h" | 46 #include "core/workers/WorkerScriptLoader.h" |
| 47 #include "core/workers/WorkerScriptLoaderClient.h" | 47 #include "core/workers/WorkerScriptLoaderClient.h" |
| 48 #include "core/workers/WorkerThreadStartupData.h" | 48 #include "core/workers/WorkerThreadStartupData.h" |
| 49 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
| 49 #include "modules/serviceworkers/ServiceWorkerThread.h" | 50 #include "modules/serviceworkers/ServiceWorkerThread.h" |
| 50 #include "platform/SharedBuffer.h" | 51 #include "platform/SharedBuffer.h" |
| 51 #include "platform/heap/Handle.h" | 52 #include "platform/heap/Handle.h" |
| 52 #include "platform/network/ContentSecurityPolicyParsers.h" | 53 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 53 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 54 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
| 54 #include "public/platform/Platform.h" | 55 #include "public/platform/Platform.h" |
| 56 #include "public/platform/WebServiceWorkerProvider.h" |
| 55 #include "public/platform/WebURLRequest.h" | 57 #include "public/platform/WebURLRequest.h" |
| 56 #include "public/web/WebDevToolsAgent.h" | 58 #include "public/web/WebDevToolsAgent.h" |
| 57 #include "public/web/WebServiceWorkerContextClient.h" | 59 #include "public/web/WebServiceWorkerContextClient.h" |
| 58 #include "public/web/WebServiceWorkerNetworkProvider.h" | 60 #include "public/web/WebServiceWorkerNetworkProvider.h" |
| 59 #include "public/web/WebSettings.h" | 61 #include "public/web/WebSettings.h" |
| 60 #include "public/web/WebView.h" | 62 #include "public/web/WebView.h" |
| 61 #include "public/web/WebWorkerPermissionClientProxy.h" | 63 #include "public/web/WebWorkerPermissionClientProxy.h" |
| 62 #include "web/ServiceWorkerGlobalScopeClientImpl.h" | 64 #include "web/ServiceWorkerGlobalScopeClientImpl.h" |
| 63 #include "web/ServiceWorkerGlobalScopeProxy.h" | 65 #include "web/ServiceWorkerGlobalScopeProxy.h" |
| 64 #include "web/WebDataSourceImpl.h" | 66 #include "web/WebDataSourceImpl.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; | 417 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; |
| 416 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) | 418 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) |
| 417 startMode = PauseWorkerGlobalScopeOnStart; | 419 startMode = PauseWorkerGlobalScopeOnStart; |
| 418 | 420 |
| 419 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 421 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
| 420 SecurityOrigin* starterOrigin = document->securityOrigin(); | 422 SecurityOrigin* starterOrigin = document->securityOrigin(); |
| 421 | 423 |
| 422 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 424 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 423 providePermissionClientToWorker(workerClients.get(), m_permissionClient.rele
ase()); | 425 providePermissionClientToWorker(workerClients.get(), m_permissionClient.rele
ase()); |
| 424 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 426 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); |
| 427 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); |
| 425 | 428 |
| 426 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 429 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
| 427 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 430 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
| 428 | 431 |
| 429 KURL scriptURL = m_mainScriptLoader->url(); | 432 KURL scriptURL = m_mainScriptLoader->url(); |
| 430 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = | 433 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = |
| 431 WorkerThreadStartupData::create( | 434 WorkerThreadStartupData::create( |
| 432 scriptURL, | 435 scriptURL, |
| 433 m_workerStartData.userAgent, | 436 m_workerStartData.userAgent, |
| 434 m_mainScriptLoader->script(), | 437 m_mainScriptLoader->script(), |
| 435 startMode, | 438 startMode, |
| 436 document->contentSecurityPolicy()->deprecatedHeader(), | 439 document->contentSecurityPolicy()->deprecatedHeader(), |
| 437 document->contentSecurityPolicy()->deprecatedHeaderType(), | 440 document->contentSecurityPolicy()->deprecatedHeaderType(), |
| 438 starterOrigin, | 441 starterOrigin, |
| 439 workerClients.release()); | 442 workerClients.release()); |
| 440 | 443 |
| 441 m_mainScriptLoader.clear(); | 444 m_mainScriptLoader.clear(); |
| 442 | 445 |
| 443 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 446 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 444 m_loaderProxy = LoaderProxy::create(*this); | 447 m_loaderProxy = LoaderProxy::create(*this); |
| 445 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); | 448 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); |
| 446 m_workerThread->start(); | 449 m_workerThread->start(); |
| 447 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 450 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 448 } | 451 } |
| 449 | 452 |
| 450 } // namespace blink | 453 } // namespace blink |
| OLD | NEW |