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/shared_worker/embedded_shared_worker_stub.h" | 5 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
6 | 6 |
7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
8 #include "content/child/scoped_child_process_reference.h" | 8 #include "content/child/scoped_child_process_reference.h" |
9 #include "content/child/shared_worker_devtools_agent.h" | 9 #include "content/child/shared_worker_devtools_agent.h" |
10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 } | 135 } |
136 | 136 |
137 void EmbeddedSharedWorkerStub::OnConnect(int sent_message_port_id, | 137 void EmbeddedSharedWorkerStub::OnConnect(int sent_message_port_id, |
138 int routing_id) { | 138 int routing_id) { |
139 WebMessagePortChannelImpl* channel = | 139 WebMessagePortChannelImpl* channel = |
140 new WebMessagePortChannelImpl(routing_id, | 140 new WebMessagePortChannelImpl(routing_id, |
141 sent_message_port_id, | 141 sent_message_port_id, |
142 base::MessageLoopProxy::current().get()); | 142 base::MessageLoopProxy::current().get()); |
143 if (runing_) { | 143 if (runing_) { |
144 impl_->connect(channel); | 144 impl_->connect(channel); |
145 Send(new WorkerHostMsg_WorkerConnected(channel->message_port_id(), | |
146 route_id_)); | |
kinuko
2014/03/10 13:26:02
Should we add ConnectToChannel() method which alwa
horo
2014/03/11 01:14:12
Done.
| |
145 } else { | 147 } else { |
146 // If two documents try to load a SharedWorker at the same time, the | 148 // If two documents try to load a SharedWorker at the same time, the |
147 // WorkerMsg_Connect for one of the documents can come in before the | 149 // WorkerMsg_Connect for one of the documents can come in before the |
148 // worker is started. Just queue up the connect and deliver it once the | 150 // worker is started. Just queue up the connect and deliver it once the |
149 // worker starts. | 151 // worker starts. |
150 pending_channels_.push_back(channel); | 152 pending_channels_.push_back(channel); |
151 } | 153 } |
152 } | 154 } |
153 | 155 |
154 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 156 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
155 runing_ = false; | 157 runing_ = false; |
156 impl_->terminateWorkerContext(); | 158 impl_->terminateWorkerContext(); |
157 } | 159 } |
158 | 160 |
159 } // namespace content | 161 } // namespace content |
OLD | NEW |