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

Unified Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 717353004: ServiceWorker: Add support for .skipWaiting and controllerchange event(2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 6 years 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
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/service_worker/service_worker_script_context.cc
diff --git a/content/renderer/service_worker/service_worker_script_context.cc b/content/renderer/service_worker/service_worker_script_context.cc
index a21ba2a36724f98eddefeee4fabedc61cd165f4b..a86bb0a157aec485c637e3b7728b96768fccb037 100644
--- a/content/renderer/service_worker/service_worker_script_context.cc
+++ b/content/renderer/service_worker/service_worker_script_context.cc
@@ -86,6 +86,7 @@ void ServiceWorkerScriptContext::OnMessageReceived(
OnDidGetClientDocuments)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse,
OnFocusClientResponse)
+ IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -196,6 +197,13 @@ void ServiceWorkerScriptContext::FocusClient(
GetRoutingID(), request_id, client_id));
}
+void ServiceWorkerScriptContext::SkipWaiting(
+ blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) {
+ DCHECK(callbacks);
+ int request_id = pending_skip_waiting_callbacks_.Add(callbacks);
+ Send(new ServiceWorkerHostMsg_SkipWaiting(GetRoutingID(), request_id));
+}
+
void ServiceWorkerScriptContext::Send(IPC::Message* message) {
embedded_context_->Send(message);
}
@@ -368,4 +376,17 @@ void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id,
pending_focus_client_callbacks_.Remove(request_id);
}
+void ServiceWorkerScriptContext::OnDidSkipWaiting(int request_id) {
+ TRACE_EVENT0("ServiceWorker",
+ "ServiceWorkerScriptContext::OnDidSkipWaiting");
+ blink::WebServiceWorkerSkipWaitingCallbacks* callbacks =
+ pending_skip_waiting_callbacks_.Lookup(request_id);
+ if (!callbacks) {
+ NOTREACHED() << "Got stray response: " << request_id;
+ return;
+ }
+ callbacks->onSuccess();
+ pending_skip_waiting_callbacks_.Remove(request_id);
+}
+
} // namespace content
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698