| 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
|
|
|