| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 Document* document = m_mainFrame->frame()->document(); | 331 Document* document = m_mainFrame->frame()->document(); |
| 332 | 332 |
| 333 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; | 333 WorkerThreadStartMode startMode = DontPauseWorkerGlobalScopeOnStart; |
| 334 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) | 334 if (InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(document)) |
| 335 startMode = PauseWorkerGlobalScopeOnStart; | 335 startMode = PauseWorkerGlobalScopeOnStart; |
| 336 | 336 |
| 337 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 337 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
| 338 SecurityOrigin* starterOrigin = document->securityOrigin(); | 338 SecurityOrigin* starterOrigin = document->securityOrigin(); |
| 339 | 339 |
| 340 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 340 RawPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 341 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC
lient.release()); | 341 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC
lient.release()); |
| 342 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 342 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); |
| 343 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); | 343 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); |
| 344 | 344 |
| 345 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 345 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
| 346 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 346 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
| 347 | 347 |
| 348 KURL scriptURL = m_mainScriptLoader->url(); | 348 KURL scriptURL = m_mainScriptLoader->url(); |
| 349 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( | 349 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( |
| 350 scriptURL, | 350 scriptURL, |
| 351 m_workerStartData.userAgent, | 351 m_workerStartData.userAgent, |
| 352 m_mainScriptLoader->script(), | 352 m_mainScriptLoader->script(), |
| 353 m_mainScriptLoader->releaseCachedMetadata(), | 353 m_mainScriptLoader->releaseCachedMetadata(), |
| 354 startMode, | 354 startMode, |
| 355 document->contentSecurityPolicy()->headers(), | 355 document->contentSecurityPolicy()->headers(), |
| 356 starterOrigin, | 356 starterOrigin, |
| 357 workerClients.release(), | 357 workerClients.release(), |
| 358 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 358 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); |
| 359 | 359 |
| 360 m_mainScriptLoader.clear(); | 360 m_mainScriptLoader.clear(); |
| 361 | 361 |
| 362 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 362 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
| 363 m_loaderProxy = WorkerLoaderProxy::create(this); | 363 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 364 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 364 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
| 365 m_workerThread->start(startupData.release()); | 365 m_workerThread->start(startupData.release()); |
| 366 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 366 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace blink | 369 } // namespace blink |
| OLD | NEW |