Chromium Code Reviews| Index: content/renderer/shared_worker/embedded_shared_worker_stub.cc |
| diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc |
| index 7ceb3dd5062132e6c80ba007e9ea82f045f51021..cc8ba4cf180b347c8ca33f9c7af5811115f6ae51 100644 |
| --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc |
| +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc |
| @@ -192,7 +192,7 @@ void EmbeddedSharedWorkerStub::workerScriptLoaded() { |
| for (PendingChannelList::const_iterator iter = pending_channels_.begin(); |
| iter != pending_channels_.end(); |
| ++iter) { |
| - ConnectToChannel(*iter); |
| + ConnectToChannel(iter->first, iter->second); |
| } |
| pending_channels_.clear(); |
| } |
| @@ -202,8 +202,7 @@ void EmbeddedSharedWorkerStub::workerScriptLoadFailed() { |
| for (PendingChannelList::const_iterator iter = pending_channels_.begin(); |
| iter != pending_channels_.end(); |
| ++iter) { |
| - blink::WebMessagePortChannel* channel = *iter; |
| - channel->destroy(); |
| + delete iter->second; |
| } |
| pending_channels_.clear(); |
| Shutdown(); |
| @@ -297,24 +296,23 @@ bool EmbeddedSharedWorkerStub::Send(IPC::Message* message) { |
| } |
| void EmbeddedSharedWorkerStub::ConnectToChannel( |
| + int connection_request_id, |
| WebMessagePortChannelImpl* channel) { |
| impl_->connect(channel); |
|
Ken Rockot(use gerrit already)
2017/01/23 23:20:41
I think we should send the WorkerConnected message
|
| - Send( |
| - new WorkerHostMsg_WorkerConnected(channel->message_port_id(), route_id_)); |
| + Send(new WorkerHostMsg_WorkerConnected(connection_request_id, route_id_)); |
| } |
| -void EmbeddedSharedWorkerStub::OnConnect(int port, |
| - int routing_id) { |
| - WebMessagePortChannelImpl* channel = new WebMessagePortChannelImpl( |
| - routing_id, port, base::ThreadTaskRunnerHandle::Get().get()); |
| +void EmbeddedSharedWorkerStub::OnConnect(int connection_request_id, |
| + const MessagePort& port) { |
| + WebMessagePortChannelImpl* channel = new WebMessagePortChannelImpl(port); |
| if (running_) { |
| - ConnectToChannel(channel); |
| + ConnectToChannel(connection_request_id, channel); |
| } else { |
| // If two documents try to load a SharedWorker at the same time, the |
| // WorkerMsg_Connect for one of the documents can come in before the |
| // worker is started. Just queue up the connect and deliver it once the |
| // worker starts. |
| - pending_channels_.push_back(channel); |
| + pending_channels_.push_back(std::make_pair(connection_request_id, channel)); |
| } |
| } |