Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/message_port_message_filter.h" | 10 #include "content/browser/message_port_message_filter.h" |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 if (!GetContext()) | 652 if (!GetContext()) |
| 653 return; | 653 return; |
| 654 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 654 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 655 if (!registry->CanHandle(embedded_worker_id)) | 655 if (!registry->CanHandle(embedded_worker_id)) |
| 656 return; | 656 return; |
| 657 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); | 657 registry->OnWorkerReadyForInspection(render_process_id_, embedded_worker_id); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded( | 660 void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded( |
| 661 int embedded_worker_id, | 661 int embedded_worker_id, |
| 662 int thread_id) { | 662 int thread_id, |
| 663 int provider_id) { | |
| 663 TRACE_EVENT0("ServiceWorker", | 664 TRACE_EVENT0("ServiceWorker", |
| 664 "ServiceWorkerDispatcherHost::OnWorkerScriptLoaded"); | 665 "ServiceWorkerDispatcherHost::OnWorkerScriptLoaded"); |
| 665 if (!GetContext()) | 666 if (!GetContext()) |
| 666 return; | 667 return; |
| 668 | |
| 669 ServiceWorkerProviderHost* provider_host = | |
| 670 GetContext()->GetProviderHost(render_process_id_, provider_id); | |
| 671 if (!provider_host) | |
| 672 return; // The provider has already been destroyed. | |
|
kinuko
2015/01/28 07:13:11
Does this happen for ServiceWorker?
nhiroki
2015/01/28 13:43:22
Good point. ProviderDestroyed message always arriv
| |
| 673 provider_host->SetReadyToSend(thread_id); | |
| 674 | |
| 667 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 675 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 668 if (!registry->CanHandle(embedded_worker_id)) | 676 if (!registry->CanHandle(embedded_worker_id)) |
| 669 return; | 677 return; |
| 670 registry->OnWorkerScriptLoaded( | 678 registry->OnWorkerScriptLoaded( |
| 671 render_process_id_, thread_id, embedded_worker_id); | 679 render_process_id_, thread_id, embedded_worker_id); |
| 672 } | 680 } |
| 673 | 681 |
| 674 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( | 682 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( |
| 675 int embedded_worker_id) { | 683 int embedded_worker_id) { |
| 676 TRACE_EVENT0("ServiceWorker", | 684 TRACE_EVENT0("ServiceWorker", |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 931 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 939 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
| 932 if (!handle) { | 940 if (!handle) { |
| 933 BadMessageReceived(); | 941 BadMessageReceived(); |
| 934 return; | 942 return; |
| 935 } | 943 } |
| 936 handle->version()->StopWorker( | 944 handle->version()->StopWorker( |
| 937 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 945 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 938 } | 946 } |
| 939 | 947 |
| 940 } // namespace content | 948 } // namespace content |
| OLD | NEW |