OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WORKER_WEBSHAREDWORKER_STUB_H_ | 5 #ifndef CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ |
6 #define CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ | 6 #define CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/child/scoped_child_process_reference.h" | 9 #include "content/child/scoped_child_process_reference.h" |
10 #include "content/worker/websharedworkerclient_proxy.h" | 10 #include "content/worker/websharedworkerclient_proxy.h" |
11 #include "content/worker/worker_webapplicationcachehost_impl.h" | 11 #include "content/worker/worker_webapplicationcachehost_impl.h" |
12 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
13 #include "third_party/WebKit/public/web/WebSharedWorker.h" | 13 #include "third_party/WebKit/public/web/WebSharedWorker.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
| 17 class WebMessagePortChannel; |
17 class WebSharedWorker; | 18 class WebSharedWorker; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 class SharedWorkerDevToolsAgent; | 23 class SharedWorkerDevToolsAgent; |
| 24 class WebMessagePortChannelImpl; |
23 | 25 |
24 // This class creates a WebSharedWorker, and translates incoming IPCs to the | 26 // This class creates a WebSharedWorker, and translates incoming IPCs to the |
25 // appropriate WebSharedWorker APIs. | 27 // appropriate WebSharedWorker APIs. |
26 class WebSharedWorkerStub : public IPC::Listener { | 28 class WebSharedWorkerStub : public IPC::Listener { |
27 public: | 29 public: |
28 WebSharedWorkerStub(const base::string16& name, int route_id, | 30 WebSharedWorkerStub(const GURL& url, |
| 31 const base::string16& name, |
| 32 const base::string16& content_security_policy, |
| 33 blink::WebContentSecurityPolicyType security_policy_type, |
| 34 int route_id, |
29 const WorkerAppCacheInitInfo& appcache_init_info); | 35 const WorkerAppCacheInitInfo& appcache_init_info); |
30 | 36 |
31 // IPC::Listener implementation. | 37 // IPC::Listener implementation. |
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
33 virtual void OnChannelError() OVERRIDE; | 39 virtual void OnChannelError() OVERRIDE; |
34 | 40 |
35 // Invoked when the WebSharedWorkerClientProxy is shutting down. | 41 // Invoked when the WebSharedWorkerClientProxy is shutting down. |
36 void Shutdown(); | 42 void Shutdown(); |
37 | 43 |
| 44 void WorkerScriptLoaded(); |
| 45 void WorkerScriptLoadFailed(); |
| 46 |
38 // Called after terminating the worker context to make sure that the worker | 47 // Called after terminating the worker context to make sure that the worker |
39 // actually terminates (is not stuck in an infinite loop). | 48 // actually terminates (is not stuck in an infinite loop). |
40 void EnsureWorkerContextTerminates(); | 49 void EnsureWorkerContextTerminates(); |
41 | 50 |
42 WebSharedWorkerClientProxy* client() { return &client_; } | 51 WebSharedWorkerClientProxy* client() { return &client_; } |
43 | 52 |
44 const WorkerAppCacheInitInfo& appcache_init_info() const { | 53 const WorkerAppCacheInitInfo& appcache_init_info() const { |
45 return appcache_init_info_; | 54 return appcache_init_info_; |
46 } | 55 } |
47 | 56 |
(...skipping 19 matching lines...) Expand all Loading... |
67 WorkerAppCacheInitInfo appcache_init_info_; | 76 WorkerAppCacheInitInfo appcache_init_info_; |
68 | 77 |
69 // WebSharedWorkerClient that responds to outgoing API calls | 78 // WebSharedWorkerClient that responds to outgoing API calls |
70 // from the worker object. | 79 // from the worker object. |
71 WebSharedWorkerClientProxy client_; | 80 WebSharedWorkerClientProxy client_; |
72 | 81 |
73 blink::WebSharedWorker* impl_; | 82 blink::WebSharedWorker* impl_; |
74 base::string16 name_; | 83 base::string16 name_; |
75 bool started_; | 84 bool started_; |
76 GURL url_; | 85 GURL url_; |
| 86 bool worker_script_loaded_; |
77 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; | 87 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_; |
78 | 88 |
79 typedef std::pair<int, int> PendingConnectInfo; | 89 typedef std::vector<blink::WebMessagePortChannel*> PendingChannelList; |
80 typedef std::vector<PendingConnectInfo> PendingConnectInfoList; | 90 PendingChannelList pending_channels_; |
81 PendingConnectInfoList pending_connects_; | |
82 | 91 |
83 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerStub); | 92 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerStub); |
84 }; | 93 }; |
85 | 94 |
86 } // namespace content | 95 } // namespace content |
87 | 96 |
88 #endif // CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ | 97 #endif // CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_ |
OLD | NEW |