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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 route_id_ = MSG_ROUTING_NONE; | 48 route_id_ = MSG_ROUTING_NONE; |
49 } | 49 } |
50 | 50 |
51 void WebSharedWorkerProxy::CreateWorkerContext( | 51 void WebSharedWorkerProxy::CreateWorkerContext( |
52 const GURL& script_url, | 52 const GURL& script_url, |
53 bool is_shared, | 53 bool is_shared, |
54 const string16& name, | 54 const string16& name, |
55 const string16& user_agent, | 55 const string16& user_agent, |
56 const string16& source_code, | 56 const string16& source_code, |
57 const string16& content_security_policy, | 57 const string16& content_security_policy, |
58 WebKit::WebContentSecurityPolicyType policy_type, | 58 blink::WebContentSecurityPolicyType policy_type, |
59 int pending_route_id, | 59 int pending_route_id, |
60 int64 script_resource_appcache_id) { | 60 int64 script_resource_appcache_id) { |
61 DCHECK(route_id_ == MSG_ROUTING_NONE); | 61 DCHECK(route_id_ == MSG_ROUTING_NONE); |
62 ViewHostMsg_CreateWorker_Params params; | 62 ViewHostMsg_CreateWorker_Params params; |
63 params.url = script_url; | 63 params.url = script_url; |
64 params.name = name; | 64 params.name = name; |
65 params.document_id = document_id_; | 65 params.document_id = document_id_; |
66 params.render_view_route_id = render_view_route_id_; | 66 params.render_view_route_id = render_view_route_id_; |
67 params.route_id = pending_route_id; | 67 params.route_id = pending_route_id; |
68 params.script_resource_appcache_id = script_resource_appcache_id; | 68 params.script_resource_appcache_id = script_resource_appcache_id; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 queued_messages[i]->set_routing_id(route_id_); | 114 queued_messages[i]->set_routing_id(route_id_); |
115 Send(queued_messages[i]); | 115 Send(queued_messages[i]); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 bool WebSharedWorkerProxy::isStarted() { | 119 bool WebSharedWorkerProxy::isStarted() { |
120 return IsStarted(); | 120 return IsStarted(); |
121 } | 121 } |
122 | 122 |
123 void WebSharedWorkerProxy::startWorkerContext( | 123 void WebSharedWorkerProxy::startWorkerContext( |
124 const WebKit::WebURL& script_url, | 124 const blink::WebURL& script_url, |
125 const WebKit::WebString& name, | 125 const blink::WebString& name, |
126 const WebKit::WebString& user_agent, | 126 const blink::WebString& user_agent, |
127 const WebKit::WebString& source_code, | 127 const blink::WebString& source_code, |
128 const WebKit::WebString& content_security_policy, | 128 const blink::WebString& content_security_policy, |
129 WebKit::WebContentSecurityPolicyType policy_type, | 129 blink::WebContentSecurityPolicyType policy_type, |
130 long long script_resource_appcache_id) { | 130 long long script_resource_appcache_id) { |
131 DCHECK(!isStarted()); | 131 DCHECK(!isStarted()); |
132 CreateWorkerContext( | 132 CreateWorkerContext( |
133 script_url, true, name, user_agent, source_code, content_security_policy, | 133 script_url, true, name, user_agent, source_code, content_security_policy, |
134 policy_type, pending_route_id_, script_resource_appcache_id); | 134 policy_type, pending_route_id_, script_resource_appcache_id); |
135 } | 135 } |
136 | 136 |
137 void WebSharedWorkerProxy::terminateWorkerContext() { | 137 void WebSharedWorkerProxy::terminateWorkerContext() { |
138 // This API should only be invoked from worker context. | 138 // This API should only be invoked from worker context. |
139 NOTREACHED(); | 139 NOTREACHED(); |
140 } | 140 } |
141 | 141 |
142 void WebSharedWorkerProxy::clientDestroyed() { | 142 void WebSharedWorkerProxy::clientDestroyed() { |
143 // This API should only be invoked from worker context. | 143 // This API should only be invoked from worker context. |
144 NOTREACHED(); | 144 NOTREACHED(); |
145 } | 145 } |
146 | 146 |
147 void WebSharedWorkerProxy::connect(WebKit::WebMessagePortChannel* channel, | 147 void WebSharedWorkerProxy::connect(blink::WebMessagePortChannel* channel, |
148 ConnectListener* listener) { | 148 ConnectListener* listener) { |
149 WebMessagePortChannelImpl* webchannel = | 149 WebMessagePortChannelImpl* webchannel = |
150 static_cast<WebMessagePortChannelImpl*>(channel); | 150 static_cast<WebMessagePortChannelImpl*>(channel); |
151 | 151 |
152 int message_port_id = webchannel->message_port_id(); | 152 int message_port_id = webchannel->message_port_id(); |
153 DCHECK(message_port_id != MSG_ROUTING_NONE); | 153 DCHECK(message_port_id != MSG_ROUTING_NONE); |
154 webchannel->QueueMessages(); | 154 webchannel->QueueMessages(); |
155 | 155 |
156 Send(new WorkerMsg_Connect(route_id_, message_port_id, MSG_ROUTING_NONE)); | 156 Send(new WorkerMsg_Connect(route_id_, message_port_id, MSG_ROUTING_NONE)); |
157 if (HasQueuedMessages()) { | 157 if (HasQueuedMessages()) { |
(...skipping 20 matching lines...) Expand all Loading... |
178 SendQueuedMessages(); | 178 SendQueuedMessages(); |
179 | 179 |
180 // Inform any listener that the pending connect event has been sent | 180 // Inform any listener that the pending connect event has been sent |
181 // (this can result in this object being freed). | 181 // (this can result in this object being freed). |
182 if (connect_listener_) { | 182 if (connect_listener_) { |
183 connect_listener_->connected(); | 183 connect_listener_->connected(); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 } // namespace content | 187 } // namespace content |
OLD | NEW |