| 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..0b6955464c99e4e848236fd42039925ff3096a33 100644
|
| --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc
|
| +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
|
| @@ -189,22 +189,13 @@ void EmbeddedSharedWorkerStub::workerScriptLoaded() {
|
| Send(new WorkerHostMsg_WorkerScriptLoaded(route_id_));
|
| running_ = true;
|
| // Process any pending connections.
|
| - for (PendingChannelList::const_iterator iter = pending_channels_.begin();
|
| - iter != pending_channels_.end();
|
| - ++iter) {
|
| - ConnectToChannel(*iter);
|
| - }
|
| + for (auto& item : pending_channels_)
|
| + ConnectToChannel(item.first, std::move(item.second));
|
| pending_channels_.clear();
|
| }
|
|
|
| void EmbeddedSharedWorkerStub::workerScriptLoadFailed() {
|
| Send(new WorkerHostMsg_WorkerScriptLoadFailed(route_id_));
|
| - for (PendingChannelList::const_iterator iter = pending_channels_.begin();
|
| - iter != pending_channels_.end();
|
| - ++iter) {
|
| - blink::WebMessagePortChannel* channel = *iter;
|
| - channel->destroy();
|
| - }
|
| pending_channels_.clear();
|
| Shutdown();
|
| }
|
| @@ -297,24 +288,24 @@ bool EmbeddedSharedWorkerStub::Send(IPC::Message* message) {
|
| }
|
|
|
| void EmbeddedSharedWorkerStub::ConnectToChannel(
|
| - WebMessagePortChannelImpl* channel) {
|
| - impl_->connect(channel);
|
| - Send(
|
| - new WorkerHostMsg_WorkerConnected(channel->message_port_id(), route_id_));
|
| + int connection_request_id,
|
| + std::unique_ptr<WebMessagePortChannelImpl> channel) {
|
| + impl_->connect(channel.release());
|
| + 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) {
|
| + auto channel = base::MakeUnique<WebMessagePortChannelImpl>(port);
|
| if (running_) {
|
| - ConnectToChannel(channel);
|
| + ConnectToChannel(connection_request_id, std::move(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_.emplace_back(
|
| + std::make_pair(connection_request_id, std::move(channel)));
|
| }
|
| }
|
|
|
|
|