Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1970)

Unified Diff: content/renderer/shared_worker/embedded_shared_worker_stub.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add metrics and support for non-ASCII text messages to Java endpoints Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
}
}

Powered by Google App Engine
This is Rietveld 408576698