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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; | 399 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; |
398 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) | 400 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) |
399 startMode = PauseWorkerGlobalScopeOnStart; | 401 startMode = PauseWorkerGlobalScopeOnStart; |
400 | 402 |
401 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 403 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
402 SecurityOrigin* starterOrigin = document->securityOrigin(); | 404 SecurityOrigin* starterOrigin = document->securityOrigin(); |
403 | 405 |
404 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 406 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
405 providePermissionClientToWorker(workerClients.get(), m_permissionClient.rele
ase()); | 407 providePermissionClientToWorker(workerClients.get(), m_permissionClient.rele
ase()); |
406 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 408 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); |
| 409 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); |
407 | 410 |
408 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 411 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
409 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 412 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
410 | 413 |
411 KURL scriptURL = m_mainScriptLoader->url(); | 414 KURL scriptURL = m_mainScriptLoader->url(); |
412 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = | 415 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = |
413 WorkerThreadStartupData::create( | 416 WorkerThreadStartupData::create( |
414 scriptURL, | 417 scriptURL, |
415 m_workerStartData.userAgent, | 418 m_workerStartData.userAgent, |
416 m_mainScriptLoader->script(), | 419 m_mainScriptLoader->script(), |
417 startMode, | 420 startMode, |
418 document->contentSecurityPolicy()->deprecatedHeader(), | 421 document->contentSecurityPolicy()->deprecatedHeader(), |
419 document->contentSecurityPolicy()->deprecatedHeaderType(), | 422 document->contentSecurityPolicy()->deprecatedHeaderType(), |
420 starterOrigin, | 423 starterOrigin, |
421 workerClients.release()); | 424 workerClients.release()); |
422 | 425 |
423 m_mainScriptLoader.clear(); | 426 m_mainScriptLoader.clear(); |
424 | 427 |
425 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 428 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
426 m_loaderProxy = WorkerLoaderProxy::create(this); | 429 m_loaderProxy = WorkerLoaderProxy::create(this); |
427 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy, startupData.release()); | 430 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy, startupData.release()); |
428 m_workerThread->start(); | 431 m_workerThread->start(); |
429 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 432 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
430 } | 433 } |
431 | 434 |
432 } // namespace blink | 435 } // namespace blink |
OLD | NEW |