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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 void WebEmbeddedWorkerImpl::startWorkerThread() | 341 void WebEmbeddedWorkerImpl::startWorkerThread() |
342 { | 342 { |
343 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); | 343 DCHECK_EQ(m_pauseAfterDownloadState, DontPauseAfterDownload); |
344 DCHECK(!m_askedToTerminate); | 344 DCHECK(!m_askedToTerminate); |
345 | 345 |
346 Document* document = m_mainFrame->frame()->document(); | 346 Document* document = m_mainFrame->frame()->document(); |
347 | 347 |
348 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) | 348 // FIXME: this document's origin is pristine and without any extra privilege
s. (crbug.com/254993) |
349 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); | 349 SecurityOrigin* starterOrigin = document->getSecurityOrigin(); |
350 | 350 |
351 RawPtr<WorkerClients> workerClients = WorkerClients::create(); | 351 WorkerClients* workerClients = WorkerClients::create(); |
352 provideContentSettingsClientToWorker(workerClients.get(), m_contentSettingsC
lient.release()); | 352 provideContentSettingsClientToWorker(workerClients, m_contentSettingsClient.
release()); |
353 provideServiceWorkerGlobalScopeClientToWorker(workerClients.get(), ServiceWo
rkerGlobalScopeClientImpl::create(*m_workerContextClient)); | 353 provideServiceWorkerGlobalScopeClientToWorker(workerClients, ServiceWorkerGl
obalScopeClientImpl::create(*m_workerContextClient)); |
354 provideServiceWorkerContainerClientToWorker(workerClients.get(), adoptPtr(m_
workerContextClient->createServiceWorkerProvider())); | 354 provideServiceWorkerContainerClientToWorker(workerClients, adoptPtr(m_worker
ContextClient->createServiceWorkerProvider())); |
355 | 355 |
356 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. | 356 // We need to set the CSP to both the shadow page's document and the Service
WorkerGlobalScope. |
357 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); | 357 document->initContentSecurityPolicy(m_mainScriptLoader->releaseContentSecuri
tyPolicy()); |
358 | 358 |
359 KURL scriptURL = m_mainScriptLoader->url(); | 359 KURL scriptURL = m_mainScriptLoader->url(); |
360 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); | 360 WorkerThreadStartMode startMode = m_workerInspectorProxy->workerStartMode(do
cument); |
361 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( | 361 OwnPtr<WorkerThreadStartupData> startupData = WorkerThreadStartupData::creat
e( |
362 scriptURL, | 362 scriptURL, |
363 m_workerStartData.userAgent, | 363 m_workerStartData.userAgent, |
364 m_mainScriptLoader->script(), | 364 m_mainScriptLoader->script(), |
365 m_mainScriptLoader->releaseCachedMetadata(), | 365 m_mainScriptLoader->releaseCachedMetadata(), |
366 startMode, | 366 startMode, |
367 document->contentSecurityPolicy()->headers(), | 367 document->contentSecurityPolicy()->headers(), |
368 starterOrigin, | 368 starterOrigin, |
369 workerClients.release(), | 369 workerClients, |
370 m_mainScriptLoader->responseAddressSpace(), | 370 m_mainScriptLoader->responseAddressSpace(), |
371 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 371 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); |
372 | 372 |
373 m_mainScriptLoader.clear(); | 373 m_mainScriptLoader.clear(); |
374 | 374 |
375 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); | 375 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc
ument, *m_workerContextClient); |
376 m_loaderProxy = WorkerLoaderProxy::create(this); | 376 m_loaderProxy = WorkerLoaderProxy::create(this); |
377 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); | 377 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS
copeProxy); |
378 m_workerThread->start(startupData.release()); | 378 m_workerThread->start(startupData.release()); |
379 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); | 379 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(),
scriptURL); |
380 } | 380 } |
381 | 381 |
382 } // namespace blink | 382 } // namespace blink |
OLD | NEW |