| OLD | NEW |
| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 main_script_loader_->Failed()) { | 388 main_script_loader_->Failed()) { |
| 389 main_script_loader_.Clear(); | 389 main_script_loader_.Clear(); |
| 390 // This deletes 'this'. | 390 // This deletes 'this'. |
| 391 worker_context_client_->WorkerContextFailedToStart(); | 391 worker_context_client_->WorkerContextFailedToStart(); |
| 392 return; | 392 return; |
| 393 } | 393 } |
| 394 worker_context_client_->WorkerScriptLoaded(); | 394 worker_context_client_->WorkerScriptLoaded(); |
| 395 | 395 |
| 396 DEFINE_STATIC_LOCAL(CustomCountHistogram, script_size_histogram, | 396 DEFINE_STATIC_LOCAL(CustomCountHistogram, script_size_histogram, |
| 397 ("ServiceWorker.ScriptSize", 1000, 5000000, 50)); | 397 ("ServiceWorker.ScriptSize", 1000, 5000000, 50)); |
| 398 script_size_histogram.Count(main_script_loader_->Script().length()); | 398 script_size_histogram.Count(main_script_loader_->SourceText().length()); |
| 399 if (main_script_loader_->CachedMetadata()) { | 399 if (main_script_loader_->CachedMetadata()) { |
| 400 DEFINE_STATIC_LOCAL( | 400 DEFINE_STATIC_LOCAL( |
| 401 CustomCountHistogram, script_cached_metadata_size_histogram, | 401 CustomCountHistogram, script_cached_metadata_size_histogram, |
| 402 ("ServiceWorker.ScriptCachedMetadataSize", 1000, 50000000, 50)); | 402 ("ServiceWorker.ScriptCachedMetadataSize", 1000, 50000000, 50)); |
| 403 script_cached_metadata_size_histogram.Count( | 403 script_cached_metadata_size_histogram.Count( |
| 404 main_script_loader_->CachedMetadata()->size()); | 404 main_script_loader_->CachedMetadata()->size()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 if (pause_after_download_state_ == kDoPauseAfterDownload) { | 407 if (pause_after_download_state_ == kDoPauseAfterDownload) { |
| 408 pause_after_download_state_ = kIsPausedAfterDownload; | 408 pause_after_download_state_ = kIsPausedAfterDownload; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 std::unique_ptr<WorkerSettings> worker_settings = | 448 std::unique_ptr<WorkerSettings> worker_settings = |
| 449 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); | 449 WTF::WrapUnique(new WorkerSettings(document->GetSettings())); |
| 450 | 450 |
| 451 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default(); | 451 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default(); |
| 452 worker_v8_settings.v8_cache_options_ = | 452 worker_v8_settings.v8_cache_options_ = |
| 453 static_cast<V8CacheOptions>(worker_start_data_.v8_cache_options); | 453 static_cast<V8CacheOptions>(worker_start_data_.v8_cache_options); |
| 454 | 454 |
| 455 std::unique_ptr<WorkerThreadStartupData> startup_data = | 455 std::unique_ptr<WorkerThreadStartupData> startup_data = |
| 456 WorkerThreadStartupData::Create( | 456 WorkerThreadStartupData::Create( |
| 457 script_url, worker_start_data_.user_agent, | 457 script_url, worker_start_data_.user_agent, |
| 458 main_script_loader_->Script(), | 458 main_script_loader_->SourceText(), |
| 459 main_script_loader_->ReleaseCachedMetadata(), start_mode, | 459 main_script_loader_->ReleaseCachedMetadata(), start_mode, |
| 460 document->GetContentSecurityPolicy()->Headers().get(), | 460 document->GetContentSecurityPolicy()->Headers().get(), |
| 461 main_script_loader_->GetReferrerPolicy(), starter_origin, | 461 main_script_loader_->GetReferrerPolicy(), starter_origin, |
| 462 worker_clients, main_script_loader_->ResponseAddressSpace(), | 462 worker_clients, main_script_loader_->ResponseAddressSpace(), |
| 463 main_script_loader_->OriginTrialTokens(), std::move(worker_settings), | 463 main_script_loader_->OriginTrialTokens(), std::move(worker_settings), |
| 464 worker_v8_settings); | 464 worker_v8_settings); |
| 465 | 465 |
| 466 main_script_loader_.Clear(); | 466 main_script_loader_.Clear(); |
| 467 | 467 |
| 468 // We have a dummy document here for loading but it doesn't really represent | 468 // We have a dummy document here for loading but it doesn't really represent |
| 469 // the document/frame of associated document(s) for this worker. Here we | 469 // the document/frame of associated document(s) for this worker. Here we |
| 470 // populate the task runners with null document not to confuse the frame | 470 // populate the task runners with null document not to confuse the frame |
| 471 // scheduler (which will end up using the thread's default task runner). | 471 // scheduler (which will end up using the thread's default task runner). |
| 472 main_thread_task_runners_ = ParentFrameTaskRunners::Create(nullptr); | 472 main_thread_task_runners_ = ParentFrameTaskRunners::Create(nullptr); |
| 473 | 473 |
| 474 worker_global_scope_proxy_ = ServiceWorkerGlobalScopeProxy::Create( | 474 worker_global_scope_proxy_ = ServiceWorkerGlobalScopeProxy::Create( |
| 475 *this, *document, *worker_context_client_); | 475 *this, *document, *worker_context_client_); |
| 476 loader_proxy_ = WorkerLoaderProxy::Create(this); | 476 loader_proxy_ = WorkerLoaderProxy::Create(this); |
| 477 worker_thread_ = | 477 worker_thread_ = |
| 478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); | 478 ServiceWorkerThread::Create(loader_proxy_, *worker_global_scope_proxy_); |
| 479 worker_thread_->Start(std::move(startup_data), | 479 worker_thread_->Start(std::move(startup_data), |
| 480 main_thread_task_runners_.Get()); | 480 main_thread_task_runners_.Get()); |
| 481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 481 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
| 482 script_url); | 482 script_url); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |