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

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

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 7 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 20 matching lines...) Expand all
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/dom/TaskRunnerHelper.h" 35 #include "core/dom/TaskRunnerHelper.h"
36 #include "core/events/MessageEvent.h" 36 #include "core/events/MessageEvent.h"
37 #include "core/inspector/ConsoleMessage.h" 37 #include "core/inspector/ConsoleMessage.h"
38 #include "core/loader/FrameLoadRequest.h" 38 #include "core/loader/FrameLoadRequest.h"
39 #include "core/loader/FrameLoader.h" 39 #include "core/loader/FrameLoader.h"
40 #include "core/loader/ThreadableLoadingContext.h" 40 #include "core/loader/ThreadableLoadingContext.h"
41 #include "core/loader/WorkerFetchContext.h"
41 #include "core/probe/CoreProbes.h" 42 #include "core/probe/CoreProbes.h"
42 #include "core/workers/ParentFrameTaskRunners.h" 43 #include "core/workers/ParentFrameTaskRunners.h"
43 #include "core/workers/SharedWorkerGlobalScope.h" 44 #include "core/workers/SharedWorkerGlobalScope.h"
44 #include "core/workers/SharedWorkerThread.h" 45 #include "core/workers/SharedWorkerThread.h"
45 #include "core/workers/WorkerClients.h" 46 #include "core/workers/WorkerClients.h"
46 #include "core/workers/WorkerContentSettingsClient.h" 47 #include "core/workers/WorkerContentSettingsClient.h"
47 #include "core/workers/WorkerGlobalScope.h" 48 #include "core/workers/WorkerGlobalScope.h"
48 #include "core/workers/WorkerInspectorProxy.h" 49 #include "core/workers/WorkerInspectorProxy.h"
49 #include "core/workers/WorkerLoaderProxy.h" 50 #include "core/workers/WorkerLoaderProxy.h"
50 #include "core/workers/WorkerScriptLoader.h" 51 #include "core/workers/WorkerScriptLoader.h"
51 #include "core/workers/WorkerThreadStartupData.h" 52 #include "core/workers/WorkerThreadStartupData.h"
52 #include "platform/CrossThreadFunctional.h" 53 #include "platform/CrossThreadFunctional.h"
54 #include "platform/RuntimeEnabledFeatures.h"
53 #include "platform/heap/Handle.h" 55 #include "platform/heap/Handle.h"
54 #include "platform/heap/Persistent.h" 56 #include "platform/heap/Persistent.h"
55 #include "platform/loader/fetch/ResourceResponse.h" 57 #include "platform/loader/fetch/ResourceResponse.h"
56 #include "platform/network/ContentSecurityPolicyParsers.h" 58 #include "platform/network/ContentSecurityPolicyParsers.h"
57 #include "platform/weborigin/KURL.h" 59 #include "platform/weborigin/KURL.h"
58 #include "platform/weborigin/SecurityOrigin.h" 60 #include "platform/weborigin/SecurityOrigin.h"
59 #include "platform/wtf/Functional.h" 61 #include "platform/wtf/Functional.h"
60 #include "platform/wtf/PtrUtil.h" 62 #include "platform/wtf/PtrUtil.h"
61 #include "public/platform/Platform.h" 63 #include "public/platform/Platform.h"
62 #include "public/platform/WebMessagePortChannel.h" 64 #include "public/platform/WebMessagePortChannel.h"
63 #include "public/platform/WebString.h" 65 #include "public/platform/WebString.h"
64 #include "public/platform/WebURL.h" 66 #include "public/platform/WebURL.h"
65 #include "public/platform/WebURLRequest.h" 67 #include "public/platform/WebURLRequest.h"
68 #include "public/platform/WebWorkerFetchContext.h"
66 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h" 69 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider. h"
67 #include "public/web/WebDevToolsAgent.h" 70 #include "public/web/WebDevToolsAgent.h"
68 #include "public/web/WebFrame.h" 71 #include "public/web/WebFrame.h"
69 #include "public/web/WebSettings.h" 72 #include "public/web/WebSettings.h"
70 #include "public/web/WebView.h" 73 #include "public/web/WebView.h"
71 #include "public/web/WebWorkerContentSettingsClientProxy.h" 74 #include "public/web/WebWorkerContentSettingsClientProxy.h"
72 #include "web/IndexedDBClientImpl.h" 75 #include "web/IndexedDBClientImpl.h"
73 #include "web/LocalFileSystemClient.h" 76 #include "web/LocalFileSystemClient.h"
74 #include "web/WebDataSourceImpl.h" 77 #include "web/WebDataSourceImpl.h"
75 #include "web/WebLocalFrameImpl.h" 78 #include "web/WebLocalFrameImpl.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 WorkerClients* worker_clients = WorkerClients::Create(); 323 WorkerClients* worker_clients = WorkerClients::Create();
321 ProvideLocalFileSystemToWorker(worker_clients, 324 ProvideLocalFileSystemToWorker(worker_clients,
322 LocalFileSystemClient::Create()); 325 LocalFileSystemClient::Create());
323 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); 326 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin());
324 ProvideContentSettingsClientToWorker( 327 ProvideContentSettingsClientToWorker(
325 worker_clients, 328 worker_clients,
326 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( 329 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy(
327 web_security_origin))); 330 web_security_origin)));
328 ProvideIndexedDBClientToWorker(worker_clients, 331 ProvideIndexedDBClientToWorker(worker_clients,
329 IndexedDBClientImpl::Create(*worker_clients)); 332 IndexedDBClientImpl::Create(*worker_clients));
333
334 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
335 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context =
336 client_->CreateWorkerFetchContext(
337 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame())
338 ->DataSource()
339 ->GetServiceWorkerNetworkProvider());
340 DCHECK(web_worker_fetch_context);
341 // TODO(horo): Set more information about the context (ex: DataSaverEnabled)
342 // to |web_worker_fetch_context|.
343 ProvideWorkerFetchContextToWorker(worker_clients,
344 std::move(web_worker_fetch_context));
345 }
346
330 ContentSecurityPolicy* content_security_policy = 347 ContentSecurityPolicy* content_security_policy =
331 main_script_loader_->ReleaseContentSecurityPolicy(); 348 main_script_loader_->ReleaseContentSecurityPolicy();
332 WorkerThreadStartMode start_mode = 349 WorkerThreadStartMode start_mode =
333 worker_inspector_proxy_->WorkerStartMode(document); 350 worker_inspector_proxy_->WorkerStartMode(document);
334 std::unique_ptr<WorkerSettings> worker_settings = 351 std::unique_ptr<WorkerSettings> worker_settings =
335 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); 352 WTF::WrapUnique(new WorkerSettings(document->GetSettings()));
336 std::unique_ptr<WorkerThreadStartupData> startup_data = 353 std::unique_ptr<WorkerThreadStartupData> startup_data =
337 WorkerThreadStartupData::Create( 354 WorkerThreadStartupData::Create(
338 url_, loading_document_->UserAgent(), 355 url_, loading_document_->UserAgent(),
339 main_script_loader_->SourceText(), nullptr, start_mode, 356 main_script_loader_->SourceText(), nullptr, start_mode,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (devtools_agent) 425 if (devtools_agent)
409 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, 426 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method,
410 message); 427 message);
411 } 428 }
412 429
413 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { 430 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) {
414 return new WebSharedWorkerImpl(client); 431 return new WebSharedWorkerImpl(client);
415 } 432 }
416 433
417 } // namespace blink 434 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebRuntimeFeatures.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698