| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 client_->DidReceiveResourceTiming(*info); | 421 client_->DidReceiveResourceTiming(*info); |
| 422 } | 422 } |
| 423 | 423 |
| 424 DEFINE_TRACE(WorkerThreadableLoader) { | 424 DEFINE_TRACE(WorkerThreadableLoader) { |
| 425 visitor->Trace(worker_global_scope_); | 425 visitor->Trace(worker_global_scope_); |
| 426 ThreadableLoader::Trace(visitor); | 426 ThreadableLoader::Trace(visitor); |
| 427 } | 427 } |
| 428 | 428 |
| 429 void WorkerThreadableLoader::MainThreadLoaderHolder::CreateAndStart( | 429 void WorkerThreadableLoader::MainThreadLoaderHolder::CreateAndStart( |
| 430 WorkerThreadableLoader* worker_loader, | 430 WorkerThreadableLoader* worker_loader, |
| 431 PassRefPtr<WorkerLoaderProxy> pass_loader_proxy, | 431 RefPtr<WorkerLoaderProxy> loader_proxy, |
| 432 WorkerThreadLifecycleContext* worker_thread_lifecycle_context, | 432 WorkerThreadLifecycleContext* worker_thread_lifecycle_context, |
| 433 std::unique_ptr<CrossThreadResourceRequestData> request, | 433 std::unique_ptr<CrossThreadResourceRequestData> request, |
| 434 const ThreadableLoaderOptions& options, | 434 const ThreadableLoaderOptions& options, |
| 435 const ResourceLoaderOptions& resource_loader_options, | 435 const ResourceLoaderOptions& resource_loader_options, |
| 436 PassRefPtr<WaitableEventWithTasks> event_with_tasks) { | 436 PassRefPtr<WaitableEventWithTasks> event_with_tasks) { |
| 437 DCHECK(IsMainThread()); | 437 DCHECK(IsMainThread()); |
| 438 TaskForwarder* forwarder; | 438 TaskForwarder* forwarder; |
| 439 RefPtr<WorkerLoaderProxy> loader_proxy = pass_loader_proxy; | |
| 440 ThreadableLoadingContext* loading_context = | 439 ThreadableLoadingContext* loading_context = |
| 441 loader_proxy->GetThreadableLoadingContext(); | 440 loader_proxy->GetThreadableLoadingContext(); |
| 442 if (!loading_context) | 441 if (!loading_context) |
| 443 return; | 442 return; |
| 444 if (event_with_tasks) | 443 if (event_with_tasks) |
| 445 forwarder = new SyncTaskForwarder(std::move(event_with_tasks)); | 444 forwarder = new SyncTaskForwarder(std::move(event_with_tasks)); |
| 446 else | 445 else |
| 447 forwarder = new AsyncTaskForwarder(loader_proxy); | 446 forwarder = new AsyncTaskForwarder(std::move(loader_proxy)); |
| 448 | 447 |
| 449 MainThreadLoaderHolder* main_thread_loader_holder = | 448 MainThreadLoaderHolder* main_thread_loader_holder = |
| 450 new MainThreadLoaderHolder(forwarder, worker_thread_lifecycle_context); | 449 new MainThreadLoaderHolder(forwarder, worker_thread_lifecycle_context); |
| 451 if (main_thread_loader_holder->WasContextDestroyedBeforeObserverCreation()) { | 450 if (main_thread_loader_holder->WasContextDestroyedBeforeObserverCreation()) { |
| 452 // The thread is already terminating. | 451 // The thread is already terminating. |
| 453 forwarder->Abort(); | 452 forwarder->Abort(); |
| 454 main_thread_loader_holder->forwarder_ = nullptr; | 453 main_thread_loader_holder->forwarder_ = nullptr; |
| 455 return; | 454 return; |
| 456 } | 455 } |
| 457 main_thread_loader_holder->worker_loader_ = worker_loader; | 456 main_thread_loader_holder->worker_loader_ = worker_loader; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 DCHECK(IsMainThread()); | 669 DCHECK(IsMainThread()); |
| 671 ResourceLoaderOptions resource_loader_options = | 670 ResourceLoaderOptions resource_loader_options = |
| 672 original_resource_loader_options; | 671 original_resource_loader_options; |
| 673 resource_loader_options.request_initiator_context = kWorkerContext; | 672 resource_loader_options.request_initiator_context = kWorkerContext; |
| 674 main_thread_loader_ = DocumentThreadableLoader::Create( | 673 main_thread_loader_ = DocumentThreadableLoader::Create( |
| 675 loading_context, this, options, resource_loader_options); | 674 loading_context, this, options, resource_loader_options); |
| 676 main_thread_loader_->Start(ResourceRequest(request.get())); | 675 main_thread_loader_->Start(ResourceRequest(request.get())); |
| 677 } | 676 } |
| 678 | 677 |
| 679 } // namespace blink | 678 } // namespace blink |
| OLD | NEW |