| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 int request_id = pending_registration_callbacks_.Add(callbacks); | 119 int request_id = pending_registration_callbacks_.Add(callbacks); |
| 120 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", | 120 TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", |
| 121 "ServiceWorkerDispatcher::RegisterServiceWorker", | 121 "ServiceWorkerDispatcher::RegisterServiceWorker", |
| 122 request_id, | 122 request_id, |
| 123 "Scope", pattern.spec(), | 123 "Scope", pattern.spec(), |
| 124 "Script URL", script_url.spec()); | 124 "Script URL", script_url.spec()); |
| 125 thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( | 125 thread_safe_sender_->Send(new ServiceWorkerHostMsg_RegisterServiceWorker( |
| 126 CurrentWorkerId(), request_id, provider_id, pattern, script_url)); | 126 CurrentWorkerId(), request_id, provider_id, pattern, script_url)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ServiceWorkerDispatcher::UpdateServiceWorker( |
| 130 int provider_id, |
| 131 int64 registration_id) { |
| 132 thread_safe_sender_->Send(new ServiceWorkerHostMsg_UpdateServiceWorker( |
| 133 provider_id, registration_id)); |
| 134 } |
| 135 |
| 129 void ServiceWorkerDispatcher::UnregisterServiceWorker( | 136 void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| 130 int provider_id, | 137 int provider_id, |
| 131 const GURL& pattern, | 138 const GURL& pattern, |
| 132 WebServiceWorkerUnregistrationCallbacks* callbacks) { | 139 WebServiceWorkerUnregistrationCallbacks* callbacks) { |
| 133 DCHECK(callbacks); | 140 DCHECK(callbacks); |
| 134 | 141 |
| 135 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { | 142 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { |
| 136 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> | 143 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> |
| 137 owned_callbacks(callbacks); | 144 owned_callbacks(callbacks); |
| 138 std::string error_message(kServiceWorkerUnregisterErrorPrefix); | 145 std::string error_message(kServiceWorkerUnregisterErrorPrefix); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 bool adopt_handle = true; | 695 bool adopt_handle = true; |
| 689 WebServiceWorkerRegistrationImpl* registration = | 696 WebServiceWorkerRegistrationImpl* registration = |
| 690 CreateServiceWorkerRegistration(info, adopt_handle); | 697 CreateServiceWorkerRegistration(info, adopt_handle); |
| 691 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); | 698 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); |
| 692 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); | 699 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); |
| 693 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); | 700 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); |
| 694 return registration; | 701 return registration; |
| 695 } | 702 } |
| 696 | 703 |
| 697 } // namespace content | 704 } // namespace content |
| OLD | NEW |