| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.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 DCHECK(provider_host); |
| 672 provider_host->SetReadyToSendMessagesToWorker(thread_id); |
| 673 |
| 667 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 674 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 668 if (!registry->CanHandle(embedded_worker_id)) | 675 if (!registry->CanHandle(embedded_worker_id)) |
| 669 return; | 676 return; |
| 670 registry->OnWorkerScriptLoaded( | 677 registry->OnWorkerScriptLoaded( |
| 671 render_process_id_, thread_id, embedded_worker_id); | 678 render_process_id_, thread_id, embedded_worker_id); |
| 672 } | 679 } |
| 673 | 680 |
| 674 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( | 681 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( |
| 675 int embedded_worker_id) { | 682 int embedded_worker_id) { |
| 676 TRACE_EVENT0("ServiceWorker", | 683 TRACE_EVENT0("ServiceWorker", |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 938 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
| 932 if (!handle) { | 939 if (!handle) { |
| 933 BadMessageReceived(); | 940 BadMessageReceived(); |
| 934 return; | 941 return; |
| 935 } | 942 } |
| 936 handle->version()->StopWorker( | 943 handle->version()->StopWorker( |
| 937 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 944 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 938 } | 945 } |
| 939 | 946 |
| 940 } // namespace content | 947 } // namespace content |
| OLD | NEW |