OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_service_worker_registration_impl.h" | 5 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
6 | 6 |
7 #include "content/child/service_worker/service_worker_dispatcher.h" | 7 #include "content/child/service_worker/service_worker_dispatcher.h" |
8 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h" | 8 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h" |
9 #include "content/child/service_worker/web_service_worker_impl.h" | 9 #include "content/child/service_worker/web_service_worker_impl.h" |
10 #include "content/common/service_worker/service_worker_types.h" | 10 #include "content/common/service_worker/service_worker_types.h" |
11 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistrationProxy.h " | 11 #include "third_party/WebKit/public/platform/WebServiceWorkerRegistrationProxy.h " |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 WebServiceWorkerRegistrationImpl::QueuedTask::QueuedTask( | 15 WebServiceWorkerRegistrationImpl::QueuedTask::QueuedTask( |
16 QueuedTaskType type, | 16 QueuedTaskType type, |
17 blink::WebServiceWorker* worker) | 17 blink::WebServiceWorker* worker) |
18 : type(type), | 18 : type(type), |
19 worker(worker) { | 19 worker(worker) { |
20 } | 20 } |
21 | 21 |
22 WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( | 22 WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( |
23 int provider_id, | |
23 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) | 24 scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) |
24 : handle_ref_(handle_ref.Pass()), | 25 : provider_id_(provider_id), |
26 handle_ref_(handle_ref.Pass()), | |
25 proxy_(NULL) { | 27 proxy_(NULL) { |
26 DCHECK(handle_ref_); | 28 DCHECK(handle_ref_); |
27 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, | 29 DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, |
28 handle_ref_->handle_id()); | 30 handle_ref_->handle_id()); |
29 ServiceWorkerDispatcher* dispatcher = | 31 ServiceWorkerDispatcher* dispatcher = |
30 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 32 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
31 DCHECK(dispatcher); | 33 DCHECK(dispatcher); |
32 dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); | 34 dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); |
33 } | 35 } |
34 | 36 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 107 |
106 blink::WebServiceWorkerRegistrationProxy* | 108 blink::WebServiceWorkerRegistrationProxy* |
107 WebServiceWorkerRegistrationImpl::proxy() { | 109 WebServiceWorkerRegistrationImpl::proxy() { |
108 return proxy_; | 110 return proxy_; |
109 } | 111 } |
110 | 112 |
111 blink::WebURL WebServiceWorkerRegistrationImpl::scope() const { | 113 blink::WebURL WebServiceWorkerRegistrationImpl::scope() const { |
112 return handle_ref_->scope(); | 114 return handle_ref_->scope(); |
113 } | 115 } |
114 | 116 |
117 void WebServiceWorkerRegistrationImpl::unregister( | |
118 UnregisterCallbacks* callbacks) { | |
119 ServiceWorkerDispatcher* dispatcher = | |
120 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | |
121 DCHECK(dispatcher); | |
122 dispatcher->UnregisterServiceWorker(provider_id_, scope(), callbacks); | |
kinuko
2015/02/03 08:02:11
If a registration outlives the document (and its p
nhiroki
2015/02/03 12:59:37
Good point. I understand that WebSWRegistration mu
| |
123 } | |
124 | |
115 int64 WebServiceWorkerRegistrationImpl::registration_id() const { | 125 int64 WebServiceWorkerRegistrationImpl::registration_id() const { |
116 return handle_ref_->registration_id(); | 126 return handle_ref_->registration_id(); |
117 } | 127 } |
118 | 128 |
119 } // namespace content | 129 } // namespace content |
OLD | NEW |