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

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

Issue 224733014: Introduce ServiceWorkerHandle for tracking WebServiceWorkerImpl reference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sigh, rebased Created 6 years, 8 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 e6b5ff1d14bcdafa3e2ab6dca8e63ecd556c76a2..734247779586b6f8cd920fb48bf3576a58fda060 100644
--- a/content/child/service_worker/service_worker_message_filter.cc
+++ b/content/child/service_worker/service_worker_message_filter.cc
@@ -8,6 +8,7 @@
#include "content/child/service_worker/service_worker_dispatcher.h"
#include "content/child/thread_safe_sender.h"
#include "content/child/worker_thread_task_runner.h"
+#include "content/common/service_worker/service_worker_messages.h"
#include "ipc/ipc_message_macros.h"
namespace content {
@@ -38,4 +39,23 @@ bool ServiceWorkerMessageFilter::OnMessageReceived(const IPC::Message& msg) {
return true;
}
+void ServiceWorkerMessageFilter::OnStaleMessageReceived(
+ const IPC::Message& msg) {
+ // Specifically handle some messages in case we failed to post task
+ // to the thread (meaning that the context on the thread is now gone).
+ IPC_BEGIN_MESSAGE_MAP(ServiceWorkerMessageFilter, msg)
+ IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ServiceWorkerRegistered,
+ OnStaleRegistered)
+ IPC_END_MESSAGE_MAP()
+}
+
+void ServiceWorkerMessageFilter::OnStaleRegistered(int32 thread_id,
+ int32 request_id,
+ int handle_id) {
+ // Inform the browser that the context seems to have been destroyed
+ // (so that it can delete the corresponding ServiceWorker handle).
+ thread_safe_sender_->Send(
+ new ServiceWorkerHostMsg_ServiceWorkerObjectDestroyed(handle_id));
+}
+
} // namespace content
« no previous file with comments | « content/child/service_worker/service_worker_message_filter.h ('k') | content/child/service_worker/web_service_worker_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698