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

Side by Side Diff: content/child/service_worker/web_service_worker_registration_impl.cc

Issue 1270513002: Service Worker: Make ServiceWorkerRegistration.update() return a promise. (Chromium 2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass a raw ptr to callback's onError instead of a scoped_ptr. Created 5 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 unified diff | Download patch
OLDNEW
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/child/service_worker/web_service_worker_provider_impl.h" 10 #include "content/child/service_worker/web_service_worker_provider_impl.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 blink::WebServiceWorkerRegistrationProxy* 107 blink::WebServiceWorkerRegistrationProxy*
108 WebServiceWorkerRegistrationImpl::proxy() { 108 WebServiceWorkerRegistrationImpl::proxy() {
109 return proxy_; 109 return proxy_;
110 } 110 }
111 111
112 blink::WebURL WebServiceWorkerRegistrationImpl::scope() const { 112 blink::WebURL WebServiceWorkerRegistrationImpl::scope() const {
113 return handle_ref_->scope(); 113 return handle_ref_->scope();
114 } 114 }
115 115
116 void WebServiceWorkerRegistrationImpl::update( 116 void WebServiceWorkerRegistrationImpl::update(
117 blink::WebServiceWorkerProvider* provider) { 117 blink::WebServiceWorkerProvider* provider,
118 WebServiceWorkerUpdateCallbacks* callbacks) {
118 WebServiceWorkerProviderImpl* provider_impl = 119 WebServiceWorkerProviderImpl* provider_impl =
119 static_cast<WebServiceWorkerProviderImpl*>(provider); 120 static_cast<WebServiceWorkerProviderImpl*>(provider);
120 ServiceWorkerDispatcher* dispatcher = 121 ServiceWorkerDispatcher* dispatcher =
121 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 122 ServiceWorkerDispatcher::GetThreadSpecificInstance();
122 DCHECK(dispatcher); 123 DCHECK(dispatcher);
123 dispatcher->UpdateServiceWorker(provider_impl->provider_id(), 124 dispatcher->UpdateServiceWorker(provider_impl->provider_id(),
124 registration_id()); 125 registration_id(), callbacks);
125 } 126 }
126 127
127 void WebServiceWorkerRegistrationImpl::unregister( 128 void WebServiceWorkerRegistrationImpl::unregister(
128 blink::WebServiceWorkerProvider* provider, 129 blink::WebServiceWorkerProvider* provider,
129 WebServiceWorkerUnregistrationCallbacks* callbacks) { 130 WebServiceWorkerUnregistrationCallbacks* callbacks) {
130 WebServiceWorkerProviderImpl* provider_impl = 131 WebServiceWorkerProviderImpl* provider_impl =
131 static_cast<WebServiceWorkerProviderImpl*>(provider); 132 static_cast<WebServiceWorkerProviderImpl*>(provider);
132 ServiceWorkerDispatcher* dispatcher = 133 ServiceWorkerDispatcher* dispatcher =
133 ServiceWorkerDispatcher::GetThreadSpecificInstance(); 134 ServiceWorkerDispatcher::GetThreadSpecificInstance();
134 DCHECK(dispatcher); 135 DCHECK(dispatcher);
135 dispatcher->UnregisterServiceWorker(provider_impl->provider_id(), 136 dispatcher->UnregisterServiceWorker(provider_impl->provider_id(),
136 registration_id(), callbacks); 137 registration_id(), callbacks);
137 } 138 }
138 139
139 int64 WebServiceWorkerRegistrationImpl::registration_id() const { 140 int64 WebServiceWorkerRegistrationImpl::registration_id() const {
140 return handle_ref_->registration_id(); 141 return handle_ref_->registration_id();
141 } 142 }
142 143
143 } // namespace content 144 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698