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/common/service_worker/service_worker_messages.h" | 8 #include "content/common/service_worker/service_worker_messages.h" |
9 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 9 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 11 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 ServiceWorkerScriptContext::ServiceWorkerScriptContext( | 15 ServiceWorkerScriptContext::ServiceWorkerScriptContext( |
16 EmbeddedWorkerContextClient* embedded_context, | 16 EmbeddedWorkerContextClient* embedded_context, |
17 blink::WebServiceWorkerContextProxy* proxy) | 17 blink::WebServiceWorkerContextProxy* proxy) |
18 : embedded_context_(embedded_context), | 18 : embedded_context_(embedded_context), |
19 proxy_(proxy) { | 19 proxy_(proxy), |
20 current_request_id_(-1) { | |
20 } | 21 } |
21 | 22 |
22 ServiceWorkerScriptContext::~ServiceWorkerScriptContext() {} | 23 ServiceWorkerScriptContext::~ServiceWorkerScriptContext() {} |
23 | 24 |
24 void ServiceWorkerScriptContext::OnMessageReceived( | 25 void ServiceWorkerScriptContext::OnMessageReceived( |
26 int request_id, | |
25 const IPC::Message& message) { | 27 const IPC::Message& message) { |
28 current_request_id_ = request_id; | |
alecflett
2014/02/04 20:53:24
lets zero this out (or set it to -1) in the handle
kinuko
2014/02/04 22:50:24
Done. I just set it to -1 in the end of this meth
| |
26 bool handled = true; | 29 bool handled = true; |
27 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) | 30 IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message) |
28 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent) | 31 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent) |
29 IPC_MESSAGE_UNHANDLED(handled = false) | 32 IPC_MESSAGE_UNHANDLED(handled = false) |
30 IPC_END_MESSAGE_MAP() | 33 IPC_END_MESSAGE_MAP() |
31 DCHECK(handled); | 34 DCHECK(handled); |
32 } | 35 } |
33 | 36 |
34 void ServiceWorkerScriptContext::Send(const IPC::Message& message) { | 37 void ServiceWorkerScriptContext::Send(int request_id, |
35 embedded_context_->SendMessageToBrowser(message); | 38 const IPC::Message& message) { |
39 embedded_context_->SendMessageToBrowser(request_id, message); | |
36 } | 40 } |
37 | 41 |
38 void ServiceWorkerScriptContext::OnFetchEvent( | 42 void ServiceWorkerScriptContext::OnFetchEvent( |
39 const ServiceWorkerFetchRequest& request) { | 43 const ServiceWorkerFetchRequest& request) { |
40 NOTIMPLEMENTED(); | 44 NOTIMPLEMENTED(); |
41 } | 45 } |
42 | 46 |
43 } // namespace content | 47 } // namespace content |
OLD | NEW |