| OLD | NEW |
| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 ProvideIndexedDBClientToWorker(worker_clients, | 340 ProvideIndexedDBClientToWorker(worker_clients, |
| 341 IndexedDBClientImpl::Create(*worker_clients)); | 341 IndexedDBClientImpl::Create(*worker_clients)); |
| 342 ContentSecurityPolicy* content_security_policy = | 342 ContentSecurityPolicy* content_security_policy = |
| 343 main_script_loader_->ReleaseContentSecurityPolicy(); | 343 main_script_loader_->ReleaseContentSecurityPolicy(); |
| 344 WorkerThreadStartMode start_mode = | 344 WorkerThreadStartMode start_mode = |
| 345 worker_inspector_proxy_->WorkerStartMode(document); | 345 worker_inspector_proxy_->WorkerStartMode(document); |
| 346 std::unique_ptr<WorkerSettings> worker_settings = | 346 std::unique_ptr<WorkerSettings> worker_settings = |
| 347 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); | 347 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); |
| 348 std::unique_ptr<WorkerThreadStartupData> startup_data = | 348 std::unique_ptr<WorkerThreadStartupData> startup_data = |
| 349 WorkerThreadStartupData::Create( | 349 WorkerThreadStartupData::Create( |
| 350 url_, loading_document_->UserAgent(), main_script_loader_->Script(), | 350 url_, loading_document_->UserAgent(), |
| 351 nullptr, start_mode, | 351 main_script_loader_->SourceText(), nullptr, start_mode, |
| 352 content_security_policy ? content_security_policy->Headers().get() | 352 content_security_policy ? content_security_policy->Headers().get() |
| 353 : nullptr, | 353 : nullptr, |
| 354 main_script_loader_->GetReferrerPolicy(), starter_origin, | 354 main_script_loader_->GetReferrerPolicy(), starter_origin, |
| 355 worker_clients, main_script_loader_->ResponseAddressSpace(), | 355 worker_clients, main_script_loader_->ResponseAddressSpace(), |
| 356 main_script_loader_->OriginTrialTokens(), std::move(worker_settings), | 356 main_script_loader_->OriginTrialTokens(), std::move(worker_settings), |
| 357 WorkerV8Settings::Default()); | 357 WorkerV8Settings::Default()); |
| 358 | 358 |
| 359 // SharedWorker can sometimes run tasks that are initiated by/associated with | 359 // SharedWorker can sometimes run tasks that are initiated by/associated with |
| 360 // a document's frame but these documents can be from a different process. So | 360 // a document's frame but these documents can be from a different process. So |
| 361 // we intentionally populate the task runners with null document in order to | 361 // we intentionally populate the task runners with null document in order to |
| 362 // use the thread's default task runner. Note that |m_document| should not be | 362 // use the thread's default task runner. Note that |m_document| should not be |
| 363 // used as it's a dummy document for loading that doesn't represent the frame | 363 // used as it's a dummy document for loading that doesn't represent the frame |
| 364 // of any associated document. | 364 // of any associated document. |
| 365 parent_frame_task_runners_ = ParentFrameTaskRunners::Create(nullptr); | 365 parent_frame_task_runners_ = ParentFrameTaskRunners::Create(nullptr); |
| 366 | 366 |
| 367 loader_proxy_ = WorkerLoaderProxy::Create(this); | 367 loader_proxy_ = WorkerLoaderProxy::Create(this); |
| 368 reporting_proxy_ = new WebSharedWorkerReportingProxyImpl( | 368 reporting_proxy_ = new WebSharedWorkerReportingProxyImpl( |
| 369 this, parent_frame_task_runners_.Get()); | 369 this, parent_frame_task_runners_.Get()); |
| 370 worker_thread_ = | 370 worker_thread_ = |
| 371 SharedWorkerThread::Create(name_, loader_proxy_, *reporting_proxy_); | 371 SharedWorkerThread::Create(name_, loader_proxy_, *reporting_proxy_); |
| 372 probe::scriptImported(loading_document_, main_script_loader_->Identifier(), | 372 probe::scriptImported(loading_document_, main_script_loader_->Identifier(), |
| 373 main_script_loader_->Script()); | 373 main_script_loader_->SourceText()); |
| 374 main_script_loader_.Clear(); | 374 main_script_loader_.Clear(); |
| 375 | 375 |
| 376 GetWorkerThread()->Start(std::move(startup_data), | 376 GetWorkerThread()->Start(std::move(startup_data), |
| 377 parent_frame_task_runners_.Get()); | 377 parent_frame_task_runners_.Get()); |
| 378 worker_inspector_proxy_->WorkerThreadCreated(ToDocument(loading_document_), | 378 worker_inspector_proxy_->WorkerThreadCreated(ToDocument(loading_document_), |
| 379 GetWorkerThread(), url_); | 379 GetWorkerThread(), url_); |
| 380 client_->WorkerScriptLoaded(); | 380 client_->WorkerScriptLoaded(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void WebSharedWorkerImpl::TerminateWorkerContext() { | 383 void WebSharedWorkerImpl::TerminateWorkerContext() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (devtools_agent) | 421 if (devtools_agent) |
| 422 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, | 422 devtools_agent->DispatchOnInspectorBackend(session_id, call_id, method, |
| 423 message); | 423 message); |
| 424 } | 424 } |
| 425 | 425 |
| 426 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { | 426 WebSharedWorker* WebSharedWorker::Create(WebSharedWorkerClient* client) { |
| 427 return new WebSharedWorkerImpl(client); | 427 return new WebSharedWorkerImpl(client); |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace blink | 430 } // namespace blink |
| OLD | NEW |