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

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

Issue 2842123002: WorkerShadowFetchContext
Patch Set: . 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) 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 30 matching lines...) Expand all
41 #include "core/loader/FrameLoadRequest.h" 41 #include "core/loader/FrameLoadRequest.h"
42 #include "core/loader/ThreadableLoadingContext.h" 42 #include "core/loader/ThreadableLoadingContext.h"
43 #include "core/loader/WorkerFetchContext.h" 43 #include "core/loader/WorkerFetchContext.h"
44 #include "core/probe/CoreProbes.h" 44 #include "core/probe/CoreProbes.h"
45 #include "core/workers/ParentFrameTaskRunners.h" 45 #include "core/workers/ParentFrameTaskRunners.h"
46 #include "core/workers/WorkerClients.h" 46 #include "core/workers/WorkerClients.h"
47 #include "core/workers/WorkerContentSettingsClient.h" 47 #include "core/workers/WorkerContentSettingsClient.h"
48 #include "core/workers/WorkerGlobalScope.h" 48 #include "core/workers/WorkerGlobalScope.h"
49 #include "core/workers/WorkerInspectorProxy.h" 49 #include "core/workers/WorkerInspectorProxy.h"
50 #include "core/workers/WorkerLoaderProxy.h" 50 #include "core/workers/WorkerLoaderProxy.h"
51 #include "core/workers/WorkerShadowFetchContext.h"
51 #include "core/workers/WorkerScriptLoader.h" 52 #include "core/workers/WorkerScriptLoader.h"
52 #include "core/workers/WorkerThreadStartupData.h" 53 #include "core/workers/WorkerThreadStartupData.h"
53 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" 54 #include "modules/serviceworkers/ServiceWorkerContainerClient.h"
54 #include "modules/serviceworkers/ServiceWorkerThread.h" 55 #include "modules/serviceworkers/ServiceWorkerThread.h"
55 #include "platform/Histogram.h" 56 #include "platform/Histogram.h"
56 #include "platform/RuntimeEnabledFeatures.h" 57 #include "platform/RuntimeEnabledFeatures.h"
57 #include "platform/SharedBuffer.h" 58 #include "platform/SharedBuffer.h"
58 #include "platform/heap/Handle.h" 59 #include "platform/heap/Handle.h"
59 #include "platform/loader/fetch/SubstituteData.h" 60 #include "platform/loader/fetch/SubstituteData.h"
60 #include "platform/network/ContentSecurityPolicyParsers.h" 61 #include "platform/network/ContentSecurityPolicyParsers.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 268 }
268 269
269 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() { 270 ThreadableLoadingContext* WebEmbeddedWorkerImpl::GetThreadableLoadingContext() {
270 if (!loading_context_) { 271 if (!loading_context_) {
271 loading_context_ = ThreadableLoadingContext::Create( 272 loading_context_ = ThreadableLoadingContext::Create(
272 *main_frame_->GetFrame()->GetDocument()); 273 *main_frame_->GetFrame()->GetDocument());
273 } 274 }
274 return loading_context_; 275 return loading_context_;
275 } 276 }
276 277
278 void WebEmbeddedWorkerImpl::InitializeShadowFetchContext() {
279 DCHECK(IsMainThread());
280 shadow_fetch_context_ = WorkerShadowFetchContext::Create(
281 worker_start_data_.script_url,
282 Platform::Current()->UserAgent(),
283 worker_start_data_.address_space,
284 nullptr, worker_context_client_->CreateServiceWorkerNetworkProvider(),
285 Settings::Create(), ParentFrameTaskRunners::Create(nullptr));
286 }
287
277 void WebEmbeddedWorkerImpl::PrepareShadowPageForLoader() { 288 void WebEmbeddedWorkerImpl::PrepareShadowPageForLoader() {
278 // Create 'shadow page', which is never displayed and is used mainly to 289 // Create 'shadow page', which is never displayed and is used mainly to
279 // provide a context for loading on the main thread. 290 // provide a context for loading on the main thread.
280 // 291 //
281 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. 292 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader.
282 // This code, and probably most of the code in this class should be shared 293 // This code, and probably most of the code in this class should be shared
283 // with SharedWorker. 294 // with SharedWorker.
284 DCHECK(!web_view_); 295 DCHECK(!web_view_);
285 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible); 296 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible);
286 WebSettings* settings = web_view_->GetSettings(); 297 WebSettings* settings = web_view_->GetSettings();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // populate the task runners with null document not to confuse the frame 484 // populate the task runners with null document not to confuse the frame
474 // scheduler (which will end up using the thread's default task runner). 485 // scheduler (which will end up using the thread's default task runner).
475 worker_thread_->Start(std::move(startup_data), 486 worker_thread_->Start(std::move(startup_data),
476 ParentFrameTaskRunners::Create(nullptr)); 487 ParentFrameTaskRunners::Create(nullptr));
477 488
478 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), 489 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(),
479 script_url); 490 script_url);
480 } 491 }
481 492
482 } // namespace blink 493 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698