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 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 13 matching lines...) Expand all Loading... |
24 // rather than having EmbeddedWorkerContextClient implement it. | 24 // rather than having EmbeddedWorkerContextClient implement it. |
25 // See the header comment in embedded_worker_context_client.h for the | 25 // See the header comment in embedded_worker_context_client.h for the |
26 // potential EW/SW layering concerns. | 26 // potential EW/SW layering concerns. |
27 class ServiceWorkerScriptContext { | 27 class ServiceWorkerScriptContext { |
28 public: | 28 public: |
29 ServiceWorkerScriptContext( | 29 ServiceWorkerScriptContext( |
30 EmbeddedWorkerContextClient* embedded_context, | 30 EmbeddedWorkerContextClient* embedded_context, |
31 blink::WebServiceWorkerContextProxy* proxy); | 31 blink::WebServiceWorkerContextProxy* proxy); |
32 ~ServiceWorkerScriptContext(); | 32 ~ServiceWorkerScriptContext(); |
33 | 33 |
34 void OnMessageReceived(const IPC::Message& message); | 34 void OnMessageReceived(int request_id, const IPC::Message& message); |
35 | 35 |
36 private: | 36 private: |
37 // Send message back to the browser. | 37 // Send message back to the browser. |
38 void Send(const IPC::Message& message); | 38 void Send(int request_id, const IPC::Message& message); |
39 | 39 |
40 void OnFetchEvent(const ServiceWorkerFetchRequest& request); | 40 void OnFetchEvent(const ServiceWorkerFetchRequest& request); |
41 | 41 |
42 // Not owned; embedded_context_ owns this. | 42 // Not owned; embedded_context_ owns this. |
43 EmbeddedWorkerContextClient* embedded_context_; | 43 EmbeddedWorkerContextClient* embedded_context_; |
44 | 44 |
45 // Not owned; this object is destroyed when proxy_ becomes invalid. | 45 // Not owned; this object is destroyed when proxy_ becomes invalid. |
46 blink::WebServiceWorkerContextProxy* proxy_; | 46 blink::WebServiceWorkerContextProxy* proxy_; |
47 | 47 |
| 48 // Used by message handlers. |
| 49 int current_request_id_; |
| 50 |
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); | 51 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); |
49 }; | 52 }; |
50 | 53 |
51 } // namespace content | 54 } // namespace content |
52 | 55 |
53 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 56 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
OLD | NEW |