Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 2715803004: Introduce ThreadableLoadingContext: make threaded loading code one step away from Document (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/WebSharedWorkerImpl.h" 31 #include "web/WebSharedWorkerImpl.h"
32 32
33 #include <memory>
33 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
34 #include "core/events/MessageEvent.h" 35 #include "core/events/MessageEvent.h"
35 #include "core/html/HTMLFormElement.h" 36 #include "core/html/HTMLFormElement.h"
36 #include "core/inspector/ConsoleMessage.h" 37 #include "core/inspector/ConsoleMessage.h"
37 #include "core/inspector/InspectorInstrumentation.h" 38 #include "core/inspector/InspectorInstrumentation.h"
38 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
39 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
41 #include "core/loader/LoadingContext.h"
40 #include "core/page/Page.h" 42 #include "core/page/Page.h"
41 #include "core/workers/ParentFrameTaskRunners.h" 43 #include "core/workers/ParentFrameTaskRunners.h"
42 #include "core/workers/SharedWorkerGlobalScope.h" 44 #include "core/workers/SharedWorkerGlobalScope.h"
43 #include "core/workers/SharedWorkerThread.h" 45 #include "core/workers/SharedWorkerThread.h"
44 #include "core/workers/WorkerClients.h" 46 #include "core/workers/WorkerClients.h"
45 #include "core/workers/WorkerGlobalScope.h" 47 #include "core/workers/WorkerGlobalScope.h"
46 #include "core/workers/WorkerInspectorProxy.h" 48 #include "core/workers/WorkerInspectorProxy.h"
47 #include "core/workers/WorkerLoaderProxy.h" 49 #include "core/workers/WorkerLoaderProxy.h"
48 #include "core/workers/WorkerScriptLoader.h" 50 #include "core/workers/WorkerScriptLoader.h"
49 #include "core/workers/WorkerThreadStartupData.h" 51 #include "core/workers/WorkerThreadStartupData.h"
(...skipping 17 matching lines...) Expand all
67 #include "public/web/WebView.h" 69 #include "public/web/WebView.h"
68 #include "public/web/WebWorkerContentSettingsClientProxy.h" 70 #include "public/web/WebWorkerContentSettingsClientProxy.h"
69 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h" 71 #include "public/web/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
70 #include "web/IndexedDBClientImpl.h" 72 #include "web/IndexedDBClientImpl.h"
71 #include "web/LocalFileSystemClient.h" 73 #include "web/LocalFileSystemClient.h"
72 #include "web/WebDataSourceImpl.h" 74 #include "web/WebDataSourceImpl.h"
73 #include "web/WebLocalFrameImpl.h" 75 #include "web/WebLocalFrameImpl.h"
74 #include "web/WorkerContentSettingsClient.h" 76 #include "web/WorkerContentSettingsClient.h"
75 #include "wtf/Functional.h" 77 #include "wtf/Functional.h"
76 #include "wtf/PtrUtil.h" 78 #include "wtf/PtrUtil.h"
77 #include <memory>
78 79
79 namespace blink { 80 namespace blink {
80 81
81 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as 82 // TODO(toyoshim): Share implementation with WebEmbeddedWorkerImpl as much as
82 // possible. 83 // possible.
83 84
84 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client) 85 WebSharedWorkerImpl::WebSharedWorkerImpl(WebSharedWorkerClient* client)
85 : m_webView(nullptr), 86 : m_webView(nullptr),
86 m_mainFrame(nullptr), 87 m_mainFrame(nullptr),
87 m_askedToTerminate(false), 88 m_askedToTerminate(false),
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 m_parentFrameTaskRunners->get(TaskType::Networking) 307 m_parentFrameTaskRunners->get(TaskType::Networking)
307 ->postTask(FROM_HERE, std::move(task)); 308 ->postTask(FROM_HERE, std::move(task));
308 } 309 }
309 310
310 void WebSharedWorkerImpl::postTaskToWorkerGlobalScope( 311 void WebSharedWorkerImpl::postTaskToWorkerGlobalScope(
311 const WebTraceLocation& location, 312 const WebTraceLocation& location,
312 std::unique_ptr<WTF::CrossThreadClosure> task) { 313 std::unique_ptr<WTF::CrossThreadClosure> task) {
313 m_workerThread->postTask(location, std::move(task)); 314 m_workerThread->postTask(location, std::move(task));
314 } 315 }
315 316
316 ExecutionContext* WebSharedWorkerImpl::getLoaderExecutionContext() { 317 LoadingContext* WebSharedWorkerImpl::getLoadingContext() {
317 return m_loadingDocument.get(); 318 if (!m_loadingContext) {
319 m_loadingContext =
320 LoadingContext::create(*toDocument(m_loadingDocument.get()));
321 }
322 return m_loadingContext;
318 } 323 }
319 324
320 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) { 325 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) {
321 DCHECK(isMainThread()); 326 DCHECK(isMainThread());
322 workerThread()->postTask( 327 workerThread()->postTask(
323 BLINK_FROM_HERE, 328 BLINK_FROM_HERE,
324 crossThreadBind(&WebSharedWorkerImpl::connectTask, 329 crossThreadBind(&WebSharedWorkerImpl::connectTask,
325 WTF::crossThreadUnretained(this), 330 WTF::crossThreadUnretained(this),
326 WTF::passed(WebMessagePortChannelUniquePtr(webChannel)))); 331 WTF::passed(WebMessagePortChannelUniquePtr(webChannel))));
327 } 332 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 if (devtoolsAgent) 470 if (devtoolsAgent)
466 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, 471 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method,
467 message); 472 message);
468 } 473 }
469 474
470 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { 475 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) {
471 return new WebSharedWorkerImpl(client); 476 return new WebSharedWorkerImpl(client);
472 } 477 }
473 478
474 } // namespace blink 479 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698