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

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

Issue 2878933003: Makes WorkerInspectorProxy work with ExecutionContext instead of Document (Closed)
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) 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 if (main_script_loader_->Failed()) { 308 if (main_script_loader_->Failed()) {
309 main_script_loader_->Cancel(); 309 main_script_loader_->Cancel();
310 client_->WorkerScriptLoadFailed(); 310 client_->WorkerScriptLoadFailed();
311 311
312 // The SharedWorker was unable to load the initial script, so 312 // The SharedWorker was unable to load the initial script, so
313 // shut it down right here. 313 // shut it down right here.
314 delete this; 314 delete this;
315 return; 315 return;
316 } 316 }
317 317
318 Document* document = main_frame_->GetFrame()->GetDocument();
319 // FIXME: this document's origin is pristine and without any extra privileges. 318 // FIXME: this document's origin is pristine and without any extra privileges.
320 // (crbug.com/254993) 319 // (crbug.com/254993)
321 SecurityOrigin* starter_origin = document->GetSecurityOrigin(); 320 SecurityOrigin* starter_origin = loading_document_->GetSecurityOrigin();
falken 2017/05/15 06:09:35 To be honest I don't understand this FIXME... what
kinuko 2017/05/15 07:26:55 This SecurityOrigin doesn't correctly reflect some
322 321
323 WorkerClients* worker_clients = WorkerClients::Create(); 322 WorkerClients* worker_clients = WorkerClients::Create();
324 ProvideLocalFileSystemToWorker(worker_clients, 323 ProvideLocalFileSystemToWorker(worker_clients,
325 LocalFileSystemClient::Create()); 324 LocalFileSystemClient::Create());
326 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin()); 325 WebSecurityOrigin web_security_origin(loading_document_->GetSecurityOrigin());
327 ProvideContentSettingsClientToWorker( 326 ProvideContentSettingsClientToWorker(
328 worker_clients, 327 worker_clients,
329 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy( 328 WTF::WrapUnique(client_->CreateWorkerContentSettingsClientProxy(
330 web_security_origin))); 329 web_security_origin)));
331 ProvideIndexedDBClientToWorker(worker_clients, 330 ProvideIndexedDBClientToWorker(worker_clients,
332 IndexedDBClientImpl::Create(*worker_clients)); 331 IndexedDBClientImpl::Create(*worker_clients));
333 332
334 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { 333 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) {
335 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = 334 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context =
336 client_->CreateWorkerFetchContext( 335 client_->CreateWorkerFetchContext(
337 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame()) 336 WebLocalFrameImpl::FromFrame(main_frame_->GetFrame())
338 ->DataSource() 337 ->DataSource()
339 ->GetServiceWorkerNetworkProvider()); 338 ->GetServiceWorkerNetworkProvider());
340 DCHECK(web_worker_fetch_context); 339 DCHECK(web_worker_fetch_context);
341 // TODO(horo): Set more information about the context (ex: DataSaverEnabled) 340 // TODO(horo): Set more information about the context (ex: DataSaverEnabled)
342 // to |web_worker_fetch_context|. 341 // to |web_worker_fetch_context|.
343 ProvideWorkerFetchContextToWorker(worker_clients, 342 ProvideWorkerFetchContextToWorker(worker_clients,
344 std::move(web_worker_fetch_context)); 343 std::move(web_worker_fetch_context));
345 } 344 }
346 345
347 ContentSecurityPolicy* content_security_policy = 346 ContentSecurityPolicy* content_security_policy =
348 main_script_loader_->ReleaseContentSecurityPolicy(); 347 main_script_loader_->ReleaseContentSecurityPolicy();
349 WorkerThreadStartMode start_mode = 348 WorkerThreadStartMode start_mode =
350 worker_inspector_proxy_->WorkerStartMode(document); 349 worker_inspector_proxy_->WorkerStartMode(loading_document_);
351 std::unique_ptr<WorkerSettings> worker_settings = 350 std::unique_ptr<WorkerSettings> worker_settings = WTF::WrapUnique(
352 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); 351 new WorkerSettings(main_frame_->GetFrame()->GetSettings()));
353 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default(); 352 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default();
354 worker_v8_settings.atomics_wait_mode_ = 353 worker_v8_settings.atomics_wait_mode_ =
355 WorkerV8Settings::AtomicsWaitMode::kAllow; 354 WorkerV8Settings::AtomicsWaitMode::kAllow;
356 std::unique_ptr<WorkerThreadStartupData> startup_data = 355 std::unique_ptr<WorkerThreadStartupData> startup_data =
357 WorkerThreadStartupData::Create( 356 WorkerThreadStartupData::Create(
358 url_, loading_document_->UserAgent(), 357 url_, loading_document_->UserAgent(),
359 main_script_loader_->SourceText(), nullptr, start_mode, 358 main_script_loader_->SourceText(), nullptr, start_mode,
360 content_security_policy ? content_security_policy->Headers().get() 359 content_security_policy ? content_security_policy->Headers().get()
361 : nullptr, 360 : nullptr,
362 main_script_loader_->GetReferrerPolicy(), starter_origin, 361 main_script_loader_->GetReferrerPolicy(), starter_origin,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (devtools_agent) 427 if (devtools_agent)
429 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, 428 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method,
430 message); 429 message);
431 } 430 }
432 431
433 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { 432 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) {
434 return new WebSharedWorkerImpl(client); 433 return new WebSharedWorkerImpl(client);
435 } 434 }
436 435
437 } // namespace blink 436 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698