| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 int embedded_worker_id, | 683 int embedded_worker_id, |
| 684 int thread_id, | 684 int thread_id, |
| 685 int provider_id) { | 685 int provider_id) { |
| 686 TRACE_EVENT0("ServiceWorker", | 686 TRACE_EVENT0("ServiceWorker", |
| 687 "ServiceWorkerDispatcherHost::OnWorkerScriptLoaded"); | 687 "ServiceWorkerDispatcherHost::OnWorkerScriptLoaded"); |
| 688 if (!GetContext()) | 688 if (!GetContext()) |
| 689 return; | 689 return; |
| 690 | 690 |
| 691 ServiceWorkerProviderHost* provider_host = | 691 ServiceWorkerProviderHost* provider_host = |
| 692 GetContext()->GetProviderHost(render_process_id_, provider_id); | 692 GetContext()->GetProviderHost(render_process_id_, provider_id); |
| 693 DCHECK(provider_host); | 693 if (!provider_host) { |
| 694 BadMessageReceived(); |
| 695 return; |
| 696 } |
| 697 |
| 694 provider_host->SetReadyToSendMessagesToWorker(thread_id); | 698 provider_host->SetReadyToSendMessagesToWorker(thread_id); |
| 695 | 699 |
| 696 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); | 700 EmbeddedWorkerRegistry* registry = GetContext()->embedded_worker_registry(); |
| 697 if (!registry->CanHandle(embedded_worker_id)) | 701 if (!registry->CanHandle(embedded_worker_id)) |
| 698 return; | 702 return; |
| 699 registry->OnWorkerScriptLoaded( | 703 registry->OnWorkerScriptLoaded( |
| 700 render_process_id_, thread_id, embedded_worker_id); | 704 render_process_id_, thread_id, embedded_worker_id); |
| 701 } | 705 } |
| 702 | 706 |
| 703 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( | 707 void ServiceWorkerDispatcherHost::OnWorkerScriptLoadFailed( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 964 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
| 961 if (!handle) { | 965 if (!handle) { |
| 962 BadMessageReceived(); | 966 BadMessageReceived(); |
| 963 return; | 967 return; |
| 964 } | 968 } |
| 965 handle->version()->StopWorker( | 969 handle->version()->StopWorker( |
| 966 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 970 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 967 } | 971 } |
| 968 | 972 |
| 969 } // namespace content | 973 } // namespace content |
| OLD | NEW |