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..312ef2b8459f9db0d60fab8b44c6ce143713beab 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,63 @@ |
#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) { |
+ DCHECK(handle_ref_); |
+ DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, |
+ handle_ref_->handle_id()); |
+ ServiceWorkerDispatcher* dispatcher = |
+ ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
+ DCHECK(dispatcher); |
+ dispatcher->AddServiceWorkerRegistration(handle_ref_->handle_id(), this); |
} |
WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { |
+ 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 |