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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // to have same origin as the worker so the loading checks work correctly. | 323 // to have same origin as the worker so the loading checks work correctly. |
324 CString content(""); | 324 CString content(""); |
325 RefPtr<SharedBuffer> buffer( | 325 RefPtr<SharedBuffer> buffer( |
326 SharedBuffer::create(content.data(), content.length())); | 326 SharedBuffer::create(content.data(), content.length())); |
327 m_loadingShadowPage = true; | 327 m_loadingShadowPage = true; |
328 m_mainFrame->frame()->loader().load( | 328 m_mainFrame->frame()->loader().load( |
329 FrameLoadRequest(0, ResourceRequest(m_workerStartData.scriptURL), | 329 FrameLoadRequest(0, ResourceRequest(m_workerStartData.scriptURL), |
330 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); | 330 SubstituteData(buffer, "text/html", "UTF-8", KURL()))); |
331 } | 331 } |
332 | 332 |
333 void WebEmbeddedWorkerImpl::didFinishDocumentLoad(WebLocalFrame* frame) { | 333 void WebEmbeddedWorkerImpl::didFinishDocumentLoad() { |
334 DCHECK_EQ(frame, m_mainFrame); | |
335 DCHECK(!m_mainScriptLoader); | 334 DCHECK(!m_mainScriptLoader); |
336 DCHECK(m_mainFrame); | 335 DCHECK(m_mainFrame); |
337 DCHECK(m_workerContextClient); | 336 DCHECK(m_workerContextClient); |
338 DCHECK(m_loadingShadowPage); | 337 DCHECK(m_loadingShadowPage); |
339 DCHECK(!m_askedToTerminate); | 338 DCHECK(!m_askedToTerminate); |
340 m_loadingShadowPage = false; | 339 m_loadingShadowPage = false; |
341 frame->dataSource()->setServiceWorkerNetworkProvider(WTF::wrapUnique( | 340 m_mainFrame->dataSource()->setServiceWorkerNetworkProvider(WTF::wrapUnique( |
342 m_workerContextClient->createServiceWorkerNetworkProvider())); | 341 m_workerContextClient->createServiceWorkerNetworkProvider())); |
343 m_mainScriptLoader = WorkerScriptLoader::create(); | 342 m_mainScriptLoader = WorkerScriptLoader::create(); |
344 m_mainScriptLoader->setRequestContext( | 343 m_mainScriptLoader->setRequestContext( |
345 WebURLRequest::RequestContextServiceWorker); | 344 WebURLRequest::RequestContextServiceWorker); |
346 m_mainScriptLoader->loadAsynchronously( | 345 m_mainScriptLoader->loadAsynchronously( |
347 *m_mainFrame->frame()->document(), m_workerStartData.scriptURL, | 346 *m_mainFrame->frame()->document(), m_workerStartData.scriptURL, |
348 DenyCrossOriginRequests, m_workerStartData.addressSpace, nullptr, | 347 DenyCrossOriginRequests, m_workerStartData.addressSpace, nullptr, |
349 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, | 348 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, |
350 WTF::unretained(this))); | 349 WTF::unretained(this))); |
351 // Do nothing here since onScriptLoaderFinished() might have been already | 350 // Do nothing here since onScriptLoaderFinished() might have been already |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 *this, *document, *m_workerContextClient); | 470 *this, *document, *m_workerContextClient); |
472 m_loaderProxy = WorkerLoaderProxy::create(this); | 471 m_loaderProxy = WorkerLoaderProxy::create(this); |
473 m_workerThread = | 472 m_workerThread = |
474 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); | 473 ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalScopeProxy); |
475 m_workerThread->start(std::move(startupData), m_mainThreadTaskRunners.get()); | 474 m_workerThread->start(std::move(startupData), m_mainThreadTaskRunners.get()); |
476 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), | 475 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), |
477 scriptURL); | 476 scriptURL); |
478 } | 477 } |
479 | 478 |
480 } // namespace blink | 479 } // namespace blink |
OLD | NEW |