Commit ebcee6ac authored by nhiroki's avatar nhiroki Committed by Commit bot

ServiceWorker: Clean up WebServiceWorkerRegistrationImpl

BUG=n/a
TEST=should pass all existing tests (no behavioral change)

Review URL: https://codereview.chromium.org/515493002

Cr-Commit-Position: refs/heads/master@{#292302}
parent 73e898c3
...@@ -340,7 +340,7 @@ void ServiceWorkerDispatcher::SetInstallingServiceWorker( ...@@ -340,7 +340,7 @@ void ServiceWorkerDispatcher::SetInstallingServiceWorker(
registrations_.find(registration_handle_id); registrations_.find(registration_handle_id);
if (found != registrations_.end()) { if (found != registrations_.end()) {
// Populate the .installing field with the new worker object. // Populate the .installing field with the new worker object.
found->second->setInstalling(GetServiceWorker(info, false)); found->second->SetInstalling(GetServiceWorker(info, false));
if (info.handle_id != kInvalidServiceWorkerHandleId) if (info.handle_id != kInvalidServiceWorkerHandleId)
found->second->OnUpdateFound(); found->second->OnUpdateFound();
} }
...@@ -370,7 +370,7 @@ void ServiceWorkerDispatcher::SetWaitingServiceWorker( ...@@ -370,7 +370,7 @@ void ServiceWorkerDispatcher::SetWaitingServiceWorker(
registrations_.find(registration_handle_id); registrations_.find(registration_handle_id);
if (found != registrations_.end()) { if (found != registrations_.end()) {
// Populate the .waiting field with the new worker object. // Populate the .waiting field with the new worker object.
found->second->setWaiting(GetServiceWorker(info, false)); found->second->SetWaiting(GetServiceWorker(info, false));
} }
} }
...@@ -398,7 +398,7 @@ void ServiceWorkerDispatcher::SetActiveServiceWorker( ...@@ -398,7 +398,7 @@ void ServiceWorkerDispatcher::SetActiveServiceWorker(
registrations_.find(registration_handle_id); registrations_.find(registration_handle_id);
if (found != registrations_.end()) { if (found != registrations_.end()) {
// Populate the .active field with the new worker object. // Populate the .active field with the new worker object.
found->second->setActive(GetServiceWorker(info, false)); found->second->SetActive(GetServiceWorker(info, false));
} }
} }
......
...@@ -31,39 +31,39 @@ WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() { ...@@ -31,39 +31,39 @@ WebServiceWorkerRegistrationImpl::~WebServiceWorkerRegistrationImpl() {
dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id()); dispatcher->RemoveServiceWorkerRegistration(handle_ref_->handle_id());
} }
void WebServiceWorkerRegistrationImpl::OnUpdateFound() { void WebServiceWorkerRegistrationImpl::SetInstalling(
DCHECK(proxy_);
proxy_->dispatchUpdateFoundEvent();
}
void WebServiceWorkerRegistrationImpl::setProxy(
blink::WebServiceWorkerRegistrationProxy* proxy) {
proxy_ = proxy;
}
blink::WebServiceWorkerRegistrationProxy*
WebServiceWorkerRegistrationImpl::proxy() {
return proxy_;
}
void WebServiceWorkerRegistrationImpl::setInstalling(
blink::WebServiceWorker* service_worker) { blink::WebServiceWorker* service_worker) {
DCHECK(proxy_); DCHECK(proxy_);
proxy_->setInstalling(service_worker); proxy_->setInstalling(service_worker);
} }
void WebServiceWorkerRegistrationImpl::setWaiting( void WebServiceWorkerRegistrationImpl::SetWaiting(
blink::WebServiceWorker* service_worker) { blink::WebServiceWorker* service_worker) {
DCHECK(proxy_); DCHECK(proxy_);
proxy_->setWaiting(service_worker); proxy_->setWaiting(service_worker);
} }
void WebServiceWorkerRegistrationImpl::setActive( void WebServiceWorkerRegistrationImpl::SetActive(
blink::WebServiceWorker* service_worker) { blink::WebServiceWorker* service_worker) {
DCHECK(proxy_); DCHECK(proxy_);
proxy_->setActive(service_worker); proxy_->setActive(service_worker);
} }
void WebServiceWorkerRegistrationImpl::OnUpdateFound() {
DCHECK(proxy_);
proxy_->dispatchUpdateFoundEvent();
}
void WebServiceWorkerRegistrationImpl::setProxy(
blink::WebServiceWorkerRegistrationProxy* proxy) {
proxy_ = proxy;
}
blink::WebServiceWorkerRegistrationProxy*
WebServiceWorkerRegistrationImpl::proxy() {
return proxy_;
}
blink::WebURL WebServiceWorkerRegistrationImpl::scope() const { blink::WebURL WebServiceWorkerRegistrationImpl::scope() const {
return handle_ref_->scope(); return handle_ref_->scope();
} }
......
...@@ -26,14 +26,15 @@ class WebServiceWorkerRegistrationImpl ...@@ -26,14 +26,15 @@ class WebServiceWorkerRegistrationImpl
scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref); scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref);
virtual ~WebServiceWorkerRegistrationImpl(); virtual ~WebServiceWorkerRegistrationImpl();
void SetInstalling(blink::WebServiceWorker* service_worker);
void SetWaiting(blink::WebServiceWorker* service_worker);
void SetActive(blink::WebServiceWorker* service_worker);
void OnUpdateFound(); void OnUpdateFound();
// blink::WebServiceWorkerRegistration overrides.
virtual void setProxy(blink::WebServiceWorkerRegistrationProxy* proxy); virtual void setProxy(blink::WebServiceWorkerRegistrationProxy* proxy);
virtual blink::WebServiceWorkerRegistrationProxy* proxy(); virtual blink::WebServiceWorkerRegistrationProxy* proxy();
virtual void setInstalling(blink::WebServiceWorker* service_worker);
virtual void setWaiting(blink::WebServiceWorker* service_worker);
virtual void setActive(blink::WebServiceWorker* service_worker);
virtual blink::WebURL scope() const; virtual blink::WebURL scope() const;
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment