| 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 9aa65d5661b8de5cea8cff80e8c0d87a61bfce04..47b4a448497ac93c470562faa3a7527d62071e6f 100644
|
| --- a/content/renderer/service_worker/service_worker_script_context.cc
|
| +++ b/content/renderer/service_worker/service_worker_script_context.cc
|
| @@ -81,6 +81,7 @@ void ServiceWorkerScriptContext::OnMessageReceived(
|
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_MessageToWorker, OnPostMessage)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidGetClientDocuments,
|
| OnDidGetClientDocuments)
|
| + IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -157,6 +158,12 @@ void ServiceWorkerScriptContext::PostMessageToDocument(
|
| GetRoutingID(), client_id, message, base::Passed(&channels)));
|
| }
|
|
|
| +void ServiceWorkerScriptContext::SkipWaiting(blink::WebCallback* callback) {
|
| + DCHECK(callback);
|
| + int request_id = pending_skip_waiting_callbacks_.Add(callback);
|
| + Send(new ServiceWorkerHostMsg_SkipWaiting(GetRoutingID(), request_id));
|
| +}
|
| +
|
| void ServiceWorkerScriptContext::Send(IPC::Message* message) {
|
| embedded_context_->Send(message);
|
| }
|
| @@ -281,4 +288,15 @@ void ServiceWorkerScriptContext::OnDidGetClientDocuments(
|
| pending_clients_callbacks_.Remove(request_id);
|
| }
|
|
|
| +void ServiceWorkerScriptContext::OnDidSkipWaiting(int request_id) {
|
| + blink::WebCallback* callback =
|
| + pending_skip_waiting_callbacks_.Lookup(request_id);
|
| + if (!callback) {
|
| + NOTREACHED() << "Got stray response: " << request_id;
|
| + return;
|
| + }
|
| + callback->run();
|
| + pending_skip_waiting_callbacks_.Remove(request_id);
|
| +}
|
| +
|
| } // namespace content
|
|
|