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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 ServiceWorkerRegistration* registration = | 630 ServiceWorkerRegistration* registration = |
631 GetContext()->GetLiveRegistration(registration_id); | 631 GetContext()->GetLiveRegistration(registration_id); |
632 DCHECK(registration); | 632 DCHECK(registration); |
633 | 633 |
634 ServiceWorkerRegistrationObjectInfo info; | 634 ServiceWorkerRegistrationObjectInfo info; |
635 ServiceWorkerVersionAttributes attrs; | 635 ServiceWorkerVersionAttributes attrs; |
636 GetRegistrationObjectInfoAndVersionAttributes( | 636 GetRegistrationObjectInfoAndVersionAttributes( |
637 provider_host->AsWeakPtr(), registration, &info, &attrs); | 637 provider_host->AsWeakPtr(), registration, &info, &attrs); |
638 | 638 |
639 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( | 639 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
640 thread_id, request_id, info, attrs)); | 640 thread_id, request_id, provider_id, info, attrs)); |
641 TRACE_EVENT_ASYNC_END1("ServiceWorker", | 641 TRACE_EVENT_ASYNC_END1("ServiceWorker", |
642 "ServiceWorkerDispatcherHost::RegisterServiceWorker", | 642 "ServiceWorkerDispatcherHost::RegisterServiceWorker", |
643 request_id, | 643 request_id, |
644 "Registration ID", | 644 "Registration ID", |
645 registration_id); | 645 registration_id); |
646 } | 646 } |
647 | 647 |
648 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( | 648 void ServiceWorkerDispatcherHost::OnWorkerReadyForInspection( |
649 int embedded_worker_id) { | 649 int embedded_worker_id) { |
650 TRACE_EVENT0("ServiceWorker", | 650 TRACE_EVENT0("ServiceWorker", |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 ServiceWorkerVersionAttributes attrs; | 877 ServiceWorkerVersionAttributes attrs; |
878 if (status == SERVICE_WORKER_OK) { | 878 if (status == SERVICE_WORKER_OK) { |
879 DCHECK(registration.get()); | 879 DCHECK(registration.get()); |
880 if (!registration->is_uninstalling()) { | 880 if (!registration->is_uninstalling()) { |
881 GetRegistrationObjectInfoAndVersionAttributes( | 881 GetRegistrationObjectInfoAndVersionAttributes( |
882 provider_host->AsWeakPtr(), registration.get(), &info, &attrs); | 882 provider_host->AsWeakPtr(), registration.get(), &info, &attrs); |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 Send(new ServiceWorkerMsg_DidGetRegistration( | 886 Send(new ServiceWorkerMsg_DidGetRegistration( |
887 thread_id, request_id, info, attrs)); | 887 thread_id, request_id, provider_id, info, attrs)); |
888 } | 888 } |
889 | 889 |
890 void ServiceWorkerDispatcherHost::SendRegistrationError( | 890 void ServiceWorkerDispatcherHost::SendRegistrationError( |
891 int thread_id, | 891 int thread_id, |
892 int request_id, | 892 int request_id, |
893 ServiceWorkerStatusCode status, | 893 ServiceWorkerStatusCode status, |
894 const std::string& status_message) { | 894 const std::string& status_message) { |
895 base::string16 error_message; | 895 base::string16 error_message; |
896 blink::WebServiceWorkerError::ErrorType error_type; | 896 blink::WebServiceWorkerError::ErrorType error_type; |
897 GetServiceWorkerRegistrationStatusResponse(status, status_message, | 897 GetServiceWorkerRegistrationStatusResponse(status, status_message, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 938 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
939 if (!handle) { | 939 if (!handle) { |
940 BadMessageReceived(); | 940 BadMessageReceived(); |
941 return; | 941 return; |
942 } | 942 } |
943 handle->version()->StopWorker( | 943 handle->version()->StopWorker( |
944 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 944 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
945 } | 945 } |
946 | 946 |
947 } // namespace content | 947 } // namespace content |
OLD | NEW |