| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/service_worker/service_worker_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/child/webmessageportchannel_impl.h" | 8 #include "content/child/webmessageportchannel_impl.h" |
| 9 #include "content/common/service_worker/service_worker_messages.h" | 9 #include "content/common/service_worker/service_worker_messages.h" |
| 10 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 10 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) | 32 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) |
| 33 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_InstallEvent, OnInstallEvent) | 33 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_InstallEvent, OnInstallEvent) |
| 34 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent) | 34 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent) |
| 35 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Message, OnPostMessage) | 35 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Message, OnPostMessage) |
| 36 IPC_MESSAGE_UNHANDLED(handled = false) | 36 IPC_MESSAGE_UNHANDLED(handled = false) |
| 37 IPC_END_MESSAGE_MAP() | 37 IPC_END_MESSAGE_MAP() |
| 38 DCHECK(handled); | 38 DCHECK(handled); |
| 39 current_request_id_ = kInvalidServiceWorkerRequestId; | 39 current_request_id_ = kInvalidServiceWorkerRequestId; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void ServiceWorkerScriptContext::DidHandleInstallEvent(int request_id) { | 42 void ServiceWorkerScriptContext::DidHandleInstallEvent( |
| 43 Send(request_id, ServiceWorkerHostMsg_InstallEventFinished()); | 43 int request_id, |
| 44 ServiceWorkerInstallEventResult result) { |
| 45 Send(request_id, ServiceWorkerHostMsg_InstallEventFinished(result)); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void ServiceWorkerScriptContext::DidHandleFetchEvent( | 48 void ServiceWorkerScriptContext::DidHandleFetchEvent( |
| 47 int request_id, | 49 int request_id, |
| 48 ServiceWorkerFetchEventResult result, | 50 ServiceWorkerFetchEventResult result, |
| 49 const ServiceWorkerResponse& response) { | 51 const ServiceWorkerResponse& response) { |
| 50 Send(request_id, ServiceWorkerHostMsg_FetchEventFinished(result, response)); | 52 Send(request_id, ServiceWorkerHostMsg_FetchEventFinished(result, response)); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void ServiceWorkerScriptContext::Send(int request_id, | 55 void ServiceWorkerScriptContext::Send(int request_id, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { | 79 for (size_t i = 0; i < sent_message_port_ids.size(); ++i) { |
| 78 ports[i] = new WebMessagePortChannelImpl( | 80 ports[i] = new WebMessagePortChannelImpl( |
| 79 new_routing_ids[i], sent_message_port_ids[i], loop_proxy); | 81 new_routing_ids[i], sent_message_port_ids[i], loop_proxy); |
| 80 } | 82 } |
| 81 } | 83 } |
| 82 | 84 |
| 83 proxy_->dispatchMessageEvent(message, ports); | 85 proxy_->dispatchMessageEvent(message, ports); |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace content | 88 } // namespace content |
| OLD | NEW |