| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 document->parseAndSetReferrerPolicy( | 442 document->parseAndSetReferrerPolicy( |
| 443 m_mainScriptLoader->getReferrerPolicy()); | 443 m_mainScriptLoader->getReferrerPolicy()); |
| 444 } | 444 } |
| 445 | 445 |
| 446 KURL scriptURL = m_mainScriptLoader->url(); | 446 KURL scriptURL = m_mainScriptLoader->url(); |
| 447 WorkerThreadStartMode startMode = | 447 WorkerThreadStartMode startMode = |
| 448 m_workerInspectorProxy->workerStartMode(document); | 448 m_workerInspectorProxy->workerStartMode(document); |
| 449 std::unique_ptr<WorkerSettings> workerSettings = | 449 std::unique_ptr<WorkerSettings> workerSettings = |
| 450 WTF::wrapUnique(new WorkerSettings(document->settings())); | 450 WTF::wrapUnique(new WorkerSettings(document->settings())); |
| 451 | 451 |
| 452 WorkerV8Settings workerV8Settings = WorkerV8Settings::Default(); |
| 453 workerV8Settings.m_v8CacheOptions = |
| 454 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions); |
| 455 |
| 452 std::unique_ptr<WorkerThreadStartupData> startupData = | 456 std::unique_ptr<WorkerThreadStartupData> startupData = |
| 453 WorkerThreadStartupData::create( | 457 WorkerThreadStartupData::create( |
| 454 scriptURL, m_workerStartData.userAgent, m_mainScriptLoader->script(), | 458 scriptURL, m_workerStartData.userAgent, m_mainScriptLoader->script(), |
| 455 m_mainScriptLoader->releaseCachedMetadata(), startMode, | 459 m_mainScriptLoader->releaseCachedMetadata(), startMode, |
| 456 document->contentSecurityPolicy()->headers().get(), | 460 document->contentSecurityPolicy()->headers().get(), |
| 457 m_mainScriptLoader->getReferrerPolicy(), starterOrigin, workerClients, | 461 m_mainScriptLoader->getReferrerPolicy(), starterOrigin, workerClients, |
| 458 m_mainScriptLoader->responseAddressSpace(), | 462 m_mainScriptLoader->responseAddressSpace(), |
| 459 m_mainScriptLoader->originTrialTokens(), std::move(workerSettings), | 463 m_mainScriptLoader->originTrialTokens(), std::move(workerSettings), |
| 460 static_cast<V8CacheOptions>(m_workerStartData.v8CacheOptions)); | 464 workerV8Settings); |
| 461 | 465 |
| 462 m_mainScriptLoader.clear(); | 466 m_mainScriptLoader.clear(); |
| 463 | 467 |
| 464 // We have a dummy document here for loading but it doesn't really represent | 468 // We have a dummy document here for loading but it doesn't really represent |
| 465 // the document/frame of associated document(s) for this worker. Here we | 469 // the document/frame of associated document(s) for this worker. Here we |
| 466 // populate the task runners with null document not to confuse the frame | 470 // populate the task runners with null document not to confuse the frame |
| 467 // scheduler (which will end up using the thread's default task runner). | 471 // scheduler (which will end up using the thread's default task runner). |
| 468 m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr); | 472 m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr); |
| 469 | 473 |
| 470 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create( | 474 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create( |
| 471 *this, *document, *m_workerContextClient); | 475 *this, *document, *m_workerContextClient); |
| 472 m_loaderProxy = WorkerLoaderProxy::create(this); | 476 m_loaderProxy = WorkerLoaderProxy::create(this); |
| 473 m_workerThread = | 477 m_workerThread = |
| 474 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); | 478 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); |
| 475 m_workerThread->start(std::move(startupData)); | 479 m_workerThread->start(std::move(startupData)); |
| 476 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), | 480 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), |
| 477 scriptURL); | 481 scriptURL); |
| 478 } | 482 } |
| 479 | 483 |
| 480 } // namespace blink | 484 } // namespace blink |
| OLD | NEW |