| 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/child/service_worker/service_worker_dispatcher.h" | 5 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 int request_id = pending_registration_callbacks_.Add(callbacks); | 123 int request_id = pending_registration_callbacks_.Add(callbacks); |
| 124 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", | 124 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", |
| 125 "ServiceWorkerDispatcher::RegisterServiceWorker", | 125 "ServiceWorkerDispatcher::RegisterServiceWorker", |
| 126 request_id, | 126 request_id, |
| 127 "Scope", pattern.spec(), | 127 "Scope", pattern.spec(), |
| 128 "Script URL", script_url.spec()); | 128 "Script URL", script_url.spec()); |
| 129 thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( | 129 thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( |
| 130 CurrentWorkerId(), request_id, provider_id, pattern, script_url)); | 130 CurrentWorkerId(), request_id, provider_id, pattern, script_url)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void ServiceWorkerDispatcher::UpdateServiceWorker(int provider_id, |
| 134 int64 registration_id) { |
| 135 thread_safe_sender_->Send(new ServiceWorkerHostMsg_UpdateServiceWorker( |
| 136 provider_id, registration_id)); |
| 137 } |
| 138 |
| 133 void ServiceWorkerDispatcher::UnregisterServiceWorker( | 139 void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| 134 int provider_id, | 140 int provider_id, |
| 135 const GURL& pattern, | 141 const GURL& pattern, |
| 136 WebServiceWorkerUnregistrationCallbacks* callbacks) { | 142 WebServiceWorkerUnregistrationCallbacks* callbacks) { |
| 137 DCHECK(callbacks); | 143 DCHECK(callbacks); |
| 138 | 144 |
| 139 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { | 145 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { |
| 140 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> | 146 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> |
| 141 owned_callbacks(callbacks); | 147 owned_callbacks(callbacks); |
| 142 std::string error_message(kServiceWorkerUnregisterErrorPrefix); | 148 std::string error_message(kServiceWorkerUnregisterErrorPrefix); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 bool adopt_handle = true; | 772 bool adopt_handle = true; |
| 767 WebServiceWorkerRegistrationImpl* registration = | 773 WebServiceWorkerRegistrationImpl* registration = |
| 768 CreateServiceWorkerRegistration(info, adopt_handle); | 774 CreateServiceWorkerRegistration(info, adopt_handle); |
| 769 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); | 775 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); |
| 770 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); | 776 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); |
| 771 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); | 777 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); |
| 772 return registration; | 778 return registration; |
| 773 } | 779 } |
| 774 | 780 |
| 775 } // namespace content | 781 } // namespace content |
| OLD | NEW |