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

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

Issue 486083002: ServiceWorker: Introduce ServiceWorkerRegistrationObjectInfo for cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index b8c5c1ed02ad5a2ea1ed1a49ee744789f9318642..0322bb25d221a04a26b9f253de03316a3f013adc 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -205,21 +205,20 @@ WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker(
WebServiceWorkerRegistrationImpl*
ServiceWorkerDispatcher::GetServiceWorkerRegistration(
- int registration_handle_id,
- const ServiceWorkerObjectInfo& info,
+ const ServiceWorkerRegistrationObjectInfo& info,
bool adopt_handle) {
- if (registration_handle_id == kInvalidServiceWorkerRegistrationHandleId)
+ if (info.handle_id == kInvalidServiceWorkerRegistrationHandleId)
return NULL;
RegistrationObjectMap::iterator existing_registration =
- registrations_.find(registration_handle_id);
+ registrations_.find(info.handle_id);
if (existing_registration != registrations_.end()) {
if (adopt_handle) {
// We are instructed to adopt a handle but we already have one, so
// adopt and destroy a handle ref.
ServiceWorkerRegistrationHandleReference::Adopt(
- registration_handle_id, info, thread_safe_sender_);
+ info, thread_safe_sender_);
}
return existing_registration->second;
}
@@ -227,9 +226,9 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration(
scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref =
adopt_handle
? ServiceWorkerRegistrationHandleReference::Adopt(
- registration_handle_id, info, thread_safe_sender_)
+ info, thread_safe_sender_)
: ServiceWorkerRegistrationHandleReference::Create(
- registration_handle_id, info, thread_safe_sender_);
+ info, thread_safe_sender_);
// WebServiceWorkerRegistrationImpl constructor calls
// AddServiceWorkerRegistration.
@@ -239,21 +238,14 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration(
void ServiceWorkerDispatcher::OnRegistered(
int thread_id,
int request_id,
- int registration_handle_id,
- const ServiceWorkerObjectInfo& info) {
+ const ServiceWorkerRegistrationObjectInfo& info) {
WebServiceWorkerRegistrationCallbacks* callbacks =
pending_callbacks_.Lookup(request_id);
DCHECK(callbacks);
if (!callbacks)
return;
- callbacks->onSuccess(GetServiceWorkerRegistration(
- registration_handle_id, info, true));
-
- // The handle ref is unused, so adopt and destroy it.
- // TODO(nhiroki): ServiceWorkerDispatcherHost don't have to pass a handle ref.
- ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_);
-
+ callbacks->onSuccess(GetServiceWorkerRegistration(info, true));
pending_callbacks_.Remove(request_id);
}
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.h ('k') | content/child/service_worker/service_worker_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698