Chromium Code Reviews| 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 const GURL& pattern) { | |
|
kinuko
2015/06/10 06:47:17
I'm curious why we supply pattern / scopeURL in th
nhiroki
2015/06/10 06:55:26
It's used for finding a registration. Is there any
| |
| 132 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) | |
| 133 return; | |
|
falken
2015/06/10 04:04:40
Hmm, should/can we surface this error somehow? Lik
nhiroki
2015/06/10 06:36:32
I'm not really sure how to print this and other er
| |
| 134 thread_safe_sender_->Send(new ServiceWorkerHostMsg_UpdateServiceWorker( | |
| 135 provider_id, pattern)); | |
| 136 } | |
| 137 | |
| 129 void ServiceWorkerDispatcher::UnregisterServiceWorker( | 138 void ServiceWorkerDispatcher::UnregisterServiceWorker( |
| 130 int provider_id, | 139 int provider_id, |
| 131 const GURL& pattern, | 140 const GURL& pattern, |
| 132 WebServiceWorkerUnregistrationCallbacks* callbacks) { | 141 WebServiceWorkerUnregistrationCallbacks* callbacks) { |
| 133 DCHECK(callbacks); | 142 DCHECK(callbacks); |
| 134 | 143 |
| 135 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { | 144 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) { |
| 136 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> | 145 scoped_ptr<WebServiceWorkerUnregistrationCallbacks> |
| 137 owned_callbacks(callbacks); | 146 owned_callbacks(callbacks); |
| 138 std::string error_message(kServiceWorkerUnregisterErrorPrefix); | 147 std::string error_message(kServiceWorkerUnregisterErrorPrefix); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 bool adopt_handle = true; | 697 bool adopt_handle = true; |
| 689 WebServiceWorkerRegistrationImpl* registration = | 698 WebServiceWorkerRegistrationImpl* registration = |
| 690 CreateServiceWorkerRegistration(info, adopt_handle); | 699 CreateServiceWorkerRegistration(info, adopt_handle); |
| 691 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); | 700 registration->SetInstalling(GetServiceWorker(attrs.installing, adopt_handle)); |
| 692 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); | 701 registration->SetWaiting(GetServiceWorker(attrs.waiting, adopt_handle)); |
| 693 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); | 702 registration->SetActive(GetServiceWorker(attrs.active, adopt_handle)); |
| 694 return registration; | 703 return registration; |
| 695 } | 704 } |
| 696 | 705 |
| 697 } // namespace content | 706 } // namespace content |
| OLD | NEW |