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

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

Issue 2701753003: [WIP] off-main-thread loading
Patch Set: small fix Created 3 years, 8 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 19 matching lines...) Expand all
30 30
31 #include "web/WebSharedWorkerImpl.h" 31 #include "web/WebSharedWorkerImpl.h"
32 32
33 #include <memory> 33 #include <memory>
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/events/MessageEvent.h" 35 #include "core/events/MessageEvent.h"
36 #include "core/inspector/ConsoleMessage.h" 36 #include "core/inspector/ConsoleMessage.h"
37 #include "core/loader/FrameLoadRequest.h" 37 #include "core/loader/FrameLoadRequest.h"
38 #include "core/loader/FrameLoader.h" 38 #include "core/loader/FrameLoader.h"
39 #include "core/loader/ThreadableLoadingContext.h" 39 #include "core/loader/ThreadableLoadingContext.h"
40 #include "core/loader/WorkerFetchContext.h"
40 #include "core/probe/CoreProbes.h" 41 #include "core/probe/CoreProbes.h"
41 #include "core/workers/ParentFrameTaskRunners.h" 42 #include "core/workers/ParentFrameTaskRunners.h"
42 #include "core/workers/SharedWorkerGlobalScope.h" 43 #include "core/workers/SharedWorkerGlobalScope.h"
43 #include "core/workers/SharedWorkerThread.h" 44 #include "core/workers/SharedWorkerThread.h"
44 #include "core/workers/WorkerClients.h" 45 #include "core/workers/WorkerClients.h"
45 #include "core/workers/WorkerGlobalScope.h" 46 #include "core/workers/WorkerGlobalScope.h"
46 #include "core/workers/WorkerInspectorProxy.h" 47 #include "core/workers/WorkerInspectorProxy.h"
47 #include "core/workers/WorkerLoaderProxy.h" 48 #include "core/workers/WorkerLoaderProxy.h"
48 #include "core/workers/WorkerScriptLoader.h" 49 #include "core/workers/WorkerScriptLoader.h"
49 #include "core/workers/WorkerThreadStartupData.h" 50 #include "core/workers/WorkerThreadStartupData.h"
50 #include "platform/CrossThreadFunctional.h" 51 #include "platform/CrossThreadFunctional.h"
51 #include "platform/heap/Handle.h" 52 #include "platform/heap/Handle.h"
52 #include "platform/heap/Persistent.h" 53 #include "platform/heap/Persistent.h"
54 #include "platform/loader/fetch/ResourceFetcher.h"
53 #include "platform/loader/fetch/ResourceResponse.h" 55 #include "platform/loader/fetch/ResourceResponse.h"
54 #include "platform/network/ContentSecurityPolicyParsers.h" 56 #include "platform/network/ContentSecurityPolicyParsers.h"
55 #include "platform/weborigin/KURL.h" 57 #include "platform/weborigin/KURL.h"
56 #include "platform/weborigin/SecurityOrigin.h" 58 #include "platform/weborigin/SecurityOrigin.h"
57 #include "public/platform/Platform.h" 59 #include "public/platform/Platform.h"
58 #include "public/platform/WebMessagePortChannel.h" 60 #include "public/platform/WebMessagePortChannel.h"
59 #include "public/platform/WebString.h" 61 #include "public/platform/WebString.h"
60 #include "public/platform/WebURL.h" 62 #include "public/platform/WebURL.h"
61 #include "public/platform/WebURLRequest.h" 63 #include "public/platform/WebURLRequest.h"
62 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" 64 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 WorkerClients* workerClients = WorkerClients::create(); 334 WorkerClients* workerClients = WorkerClients::create();
333 provideLocalFileSystemToWorker(workerClients, 335 provideLocalFileSystemToWorker(workerClients,
334 LocalFileSystemClient::create()); 336 LocalFileSystemClient::create());
335 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin()); 337 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->getSecurityOrigin());
336 provideContentSettingsClientToWorker( 338 provideContentSettingsClientToWorker(
337 workerClients, 339 workerClients,
338 WTF::wrapUnique( 340 WTF::wrapUnique(
339 m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin))); 341 m_client->createWorkerContentSettingsClientProxy(webSecurityOrigin)));
340 provideIndexedDBClientToWorker(workerClients, 342 provideIndexedDBClientToWorker(workerClients,
341 IndexedDBClientImpl::create(*workerClients)); 343 IndexedDBClientImpl::create(*workerClients));
344
345 std::unique_ptr<WebWorkerFetchContextInfo> webWorkerFetchContextInfo =
346 Platform::current()->createWorkerFetchContextInfo();
347 // |webWorkerFetchContextInfo| is null if off-main-thread-fetch is disabled.
348 if (webWorkerFetchContextInfo) {
349 webWorkerFetchContextInfo->setAppCacheHostID(
350 document->fetcher()->context().applicationCacheHostID());
351 webWorkerFetchContextInfo->setIsSecureContext(document->isSecureContext());
352 WebLocalFrameImpl* webFrame =
353 WebLocalFrameImpl::fromFrame(document->frame());
354 WebServiceWorkerNetworkProvider* provider =
355 webFrame->dataSource()->getServiceWorkerNetworkProvider();
356 webWorkerFetchContextInfo->setServiceWorkerProviderID(
357 provider->providerID());
358 webWorkerFetchContextInfo->setIsControlledByServiceWorker(
359 provider->isControlledByServiceWorker());
360 provideWorkerFetchContextInfoToWorker(workerClients,
361 std::move(webWorkerFetchContextInfo));
362 WorkerFetchContextInfo* workerFetchContextInfo =
363 WorkerFetchContextInfo::from(*workerClients);
364 workerFetchContextInfo->setDataSaverEnabled(
365 document->frame()->settings()->getDataSaverEnabled());
366 workerFetchContextInfo->setStrictMixedContentCheckingEnabled(
367 document->frame()->settings()->getStrictMixedContentChecking());
368 }
369
342 ContentSecurityPolicy* contentSecurityPolicy = 370 ContentSecurityPolicy* contentSecurityPolicy =
343 m_mainScriptLoader->releaseContentSecurityPolicy(); 371 m_mainScriptLoader->releaseContentSecurityPolicy();
344 WorkerThreadStartMode startMode = 372 WorkerThreadStartMode startMode =
345 m_workerInspectorProxy->workerStartMode(document); 373 m_workerInspectorProxy->workerStartMode(document);
346 std::unique_ptr<WorkerSettings> workerSettings = 374 std::unique_ptr<WorkerSettings> workerSettings =
347 WTF::wrapUnique(new WorkerSettings(document->settings())); 375 WTF::wrapUnique(new WorkerSettings(document->settings()));
348 std::unique_ptr<WorkerThreadStartupData> startupData = 376 std::unique_ptr<WorkerThreadStartupData> startupData =
349 WorkerThreadStartupData::create( 377 WorkerThreadStartupData::create(
350 m_url, m_loadingDocument->userAgent(), m_mainScriptLoader->script(), 378 m_url, m_loadingDocument->userAgent(), m_mainScriptLoader->script(),
351 nullptr, startMode, 379 nullptr, startMode,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (devtoolsAgent) 448 if (devtoolsAgent)
421 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, 449 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method,
422 message); 450 message);
423 } 451 }
424 452
425 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { 453 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) {
426 return new WebSharedWorkerImpl(client); 454 return new WebSharedWorkerImpl(client);
427 } 455 }
428 456
429 } // namespace blink 457 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698