Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: content/child/service_worker/web_service_worker_registration_impl.cc

Issue 463013002: ServiceWorker: Implement updatefound event and version attributes (Chromium) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address for comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698