OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/websharedworker_proxy.h" | 5 #include "content/renderer/websharedworker_proxy.h" |
6 | 6 |
7 #include "content/child/child_thread.h" | 7 #include "content/child/child_thread.h" |
8 #include "content/child/webmessageportchannel_impl.h" | 8 #include "content/child/webmessageportchannel_impl.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/common/worker_messages.h" | 10 #include "content/common/worker_messages.h" |
11 #include "third_party/WebKit/public/platform/WebURL.h" | 11 #include "third_party/WebKit/public/platform/WebURL.h" |
12 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" | 12 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 WebSharedWorkerProxy::WebSharedWorkerProxy(ChildThread* child_thread, | 16 WebSharedWorkerProxy::WebSharedWorkerProxy(ChildThread* child_thread, |
17 unsigned long long document_id, | 17 unsigned long long document_id, |
18 bool exists, | 18 bool exists, |
19 int route_id, | 19 int route_id, |
20 int render_view_route_id, | |
21 int render_frame_route_id) | 20 int render_frame_route_id) |
22 : route_id_(exists ? route_id : MSG_ROUTING_NONE), | 21 : route_id_(exists ? route_id : MSG_ROUTING_NONE), |
23 render_view_route_id_(render_view_route_id), | |
24 render_frame_route_id_(render_frame_route_id), | 22 render_frame_route_id_(render_frame_route_id), |
25 child_thread_(child_thread), | 23 child_thread_(child_thread), |
26 document_id_(document_id), | 24 document_id_(document_id), |
27 pending_route_id_(route_id), | 25 pending_route_id_(route_id), |
28 connect_listener_(NULL) { | 26 connect_listener_(NULL) { |
29 if (route_id_ != MSG_ROUTING_NONE) | 27 if (route_id_ != MSG_ROUTING_NONE) |
30 child_thread_->AddRoute(route_id_, this); | 28 child_thread_->AddRoute(route_id_, this); |
31 } | 29 } |
32 | 30 |
33 WebSharedWorkerProxy::~WebSharedWorkerProxy() { | 31 WebSharedWorkerProxy::~WebSharedWorkerProxy() { |
(...skipping 24 matching lines...) Expand all Loading... |
58 const base::string16& source_code, | 56 const base::string16& source_code, |
59 const base::string16& content_security_policy, | 57 const base::string16& content_security_policy, |
60 blink::WebContentSecurityPolicyType policy_type, | 58 blink::WebContentSecurityPolicyType policy_type, |
61 int pending_route_id, | 59 int pending_route_id, |
62 int64 script_resource_appcache_id) { | 60 int64 script_resource_appcache_id) { |
63 DCHECK(route_id_ == MSG_ROUTING_NONE); | 61 DCHECK(route_id_ == MSG_ROUTING_NONE); |
64 ViewHostMsg_CreateWorker_Params params; | 62 ViewHostMsg_CreateWorker_Params params; |
65 params.url = script_url; | 63 params.url = script_url; |
66 params.name = name; | 64 params.name = name; |
67 params.document_id = document_id_; | 65 params.document_id = document_id_; |
68 params.render_view_route_id = render_view_route_id_; | |
69 params.render_frame_route_id = render_frame_route_id_; | 66 params.render_frame_route_id = render_frame_route_id_; |
70 params.route_id = pending_route_id; | 67 params.route_id = pending_route_id; |
71 params.script_resource_appcache_id = script_resource_appcache_id; | 68 params.script_resource_appcache_id = script_resource_appcache_id; |
72 IPC::Message* create_message = new ViewHostMsg_CreateWorker( | 69 IPC::Message* create_message = new ViewHostMsg_CreateWorker( |
73 params, &route_id_); | 70 params, &route_id_); |
74 child_thread_->Send(create_message); | 71 child_thread_->Send(create_message); |
75 if (route_id_ == MSG_ROUTING_NONE) | 72 if (route_id_ == MSG_ROUTING_NONE) |
76 return; | 73 return; |
77 | 74 |
78 child_thread_->AddRoute(route_id_, this); | 75 child_thread_->AddRoute(route_id_, this); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SendQueuedMessages(); | 168 SendQueuedMessages(); |
172 | 169 |
173 // Inform any listener that the pending connect event has been sent | 170 // Inform any listener that the pending connect event has been sent |
174 // (this can result in this object being freed). | 171 // (this can result in this object being freed). |
175 if (connect_listener_) { | 172 if (connect_listener_) { |
176 connect_listener_->connected(); | 173 connect_listener_->connected(); |
177 } | 174 } |
178 } | 175 } |
179 | 176 |
180 } // namespace content | 177 } // namespace content |
OLD | NEW |