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

Unified Diff: content/child/service_worker/service_worker_message_filter.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/service_worker_message_filter.cc
diff --git a/content/child/service_worker/service_worker_message_filter.cc b/content/child/service_worker/service_worker_message_filter.cc
index 14dc6d758c451277c1fe38e1eebd17dc190496a1..0033207df91df3ac6d47b15bdd14606464dd5454 100644
--- a/content/child/service_worker/service_worker_message_filter.cc
+++ b/content/child/service_worker/service_worker_message_filter.cc
@@ -19,7 +19,7 @@ namespace {
// Sends a ServiceWorkerObjectDestroyed message to the browser so it can delete
// the ServiceWorker handle.
void SendServiceWorkerObjectDestroyed(
- scoped_refptr<ThreadSafeSender> sender,
+ ThreadSafeSender* sender,
int handle_id) {
if (handle_id == kInvalidServiceWorkerHandleId)
return;
@@ -27,6 +27,15 @@ void SendServiceWorkerObjectDestroyed(
new ServiceWorkerHostMsg_DecrementServiceWorkerRefCount(handle_id));
}
+void SendRegistrationObjectDestroyed(
+ ThreadSafeSender* sender,
+ int handle_id) {
+ if (handle_id == kInvalidServiceWorkerRegistrationHandleId)
+ return;
+ sender->Send(
+ new ServiceWorkerHostMsg_DecrementRegistrationRefCount(handle_id));
+}
+
} // namespace
ServiceWorkerMessageFilter::ServiceWorkerMessageFilter(ThreadSafeSender* sender)
@@ -72,13 +81,16 @@ void ServiceWorkerMessageFilter::OnStaleMessageReceived(
void ServiceWorkerMessageFilter::OnStaleRegistered(
int thread_id,
int request_id,
+ int registration_handle_id,
const ServiceWorkerObjectInfo& info) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_, info.handle_id);
+ SendRegistrationObjectDestroyed(thread_safe_sender_, registration_handle_id);
}
void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
int thread_id,
int provider_id,
+ int registration_handle_id,
int changed_mask,
const ServiceWorkerVersionAttributes& attributes) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_,
@@ -87,6 +99,7 @@ void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
attributes.waiting.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_,
attributes.active.handle_id);
+ SendRegistrationObjectDestroyed(thread_safe_sender_, registration_handle_id);
}
void ServiceWorkerMessageFilter::OnStaleSetControllerServiceWorker(

Powered by Google App Engine
This is Rietveld 408576698