Chromium Code Reviews| Index: content/child/service_worker/web_service_worker_registration_impl.cc |
| diff --git a/content/child/service_worker/web_service_worker_registration_impl.cc b/content/child/service_worker/web_service_worker_registration_impl.cc |
| index 66ddb707e80047f77ea62e415bf2dac95becfc9a..d6157db9329a5ca0403caae0524bbca7bbcbc2be 100644 |
| --- a/content/child/service_worker/web_service_worker_registration_impl.cc |
| +++ b/content/child/service_worker/web_service_worker_registration_impl.cc |
| @@ -4,20 +4,62 @@ |
| #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| +#include "content/child/service_worker/service_worker_dispatcher.h" |
| +#include "content/child/service_worker/service_worker_registration_handle_reference.h" |
| #include "content/common/service_worker/service_worker_types.h" |
| +#include "third_party/WebKit/public/platform/WebServiceWorkerRegistrationProxy.h" |
| namespace content { |
| WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( |
| - const ServiceWorkerObjectInfo& info) |
| - : scope_(info.scope) { |
| + scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) |
| + : handle_ref_(handle_ref.Pass()), |
| + proxy_(NULL) { |
| + ServiceWorkerDispatcher* dispatcher = |
| + ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| + DCHECK(dispatcher); |
| + dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); |
| } |
| WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
| + if (handle_ref_->handle_id() == kInvalidServiceWorkerRegistrationHandleId) |
|
michaeln
2014/08/13 04:18:17
the is no similar check for kinvalid in the ctor w
falken
2014/08/13 08:27:06
good catch, this probably can be done better. of c
nhiroki
2014/08/13 13:15:05
Done.
|
| + return; |
| + ServiceWorkerDispatcher* dispatcher = |
| + ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
| + if (dispatcher) |
| + dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); |
| +} |
| + |
| +void WebServiceWorkerRegistrationImpl::OnUpdateFound() { |
| + DCHECK(proxy_); |
| + proxy_->dispatchUpdateFoundEvent(); |
| +} |
| + |
| +void WebServiceWorkerRegistrationImpl::setProxy( |
| + blink::WebServiceWorkerRegistrationProxy* proxy) { |
| + proxy_ = proxy; |
| +} |
| + |
| +void WebServiceWorkerRegistrationImpl::setInstalling( |
| + blink::WebServiceWorker* service_worker) { |
| + DCHECK(proxy_); |
| + proxy_->setInstalling(service_worker); |
| +} |
| + |
| +void WebServiceWorkerRegistrationImpl::setWaiting( |
| + blink::WebServiceWorker* service_worker) { |
| + DCHECK(proxy_); |
| + proxy_->setWaiting(service_worker); |
| +} |
| + |
| +void WebServiceWorkerRegistrationImpl::setActive( |
| + blink::WebServiceWorker* service_worker) { |
| + DCHECK(proxy_); |
| + proxy_->setActive(service_worker); |
| } |
| blink::WebURL WebServiceWorkerRegistrationImpl::scope() const { |
| - return scope_; |
| + return handle_ref_->scope(); |
| } |
| } // namespace content |