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

Unified Diff: content/browser/message_port_service.cc

Issue 668303004: WIP DO NOT COMMIT chromium side of navigator.connect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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/browser/message_port_service.cc
diff --git a/content/browser/message_port_service.cc b/content/browser/message_port_service.cc
index 08a0aad95f4b4920aa15b997acebf5e6ff0b0665..64811ae56611898a0077cfcd4b8400978553f7ae 100644
--- a/content/browser/message_port_service.cc
+++ b/content/browser/message_port_service.cc
@@ -13,7 +13,7 @@ struct MessagePortService::MessagePort {
// |filter| and |route_id| are what we need to send messages to the port.
// |filter| is just a weak pointer since we get notified when its process has
// gone away and remove it.
- MessagePortMessageFilter* filter;
+ MessagePortHandler* filter;
int route_id;
// A globally unique id for this message port.
int message_port_id;
@@ -59,10 +59,9 @@ MessagePortService::MessagePortService()
MessagePortService::~MessagePortService() {
}
-void MessagePortService::UpdateMessagePort(
- int message_port_id,
- MessagePortMessageFilter* filter,
- int routing_id) {
+void MessagePortService::UpdateMessagePort(int message_port_id,
+ MessagePortHandler* filter,
+ int routing_id) {
if (!message_ports_.count(message_port_id)) {
NOTREACHED();
return;
@@ -74,7 +73,7 @@ void MessagePortService::UpdateMessagePort(
}
void MessagePortService::OnMessagePortMessageFilterClosing(
- MessagePortMessageFilter* filter) {
+ MessagePortHandler* filter) {
// Check if the (possibly) crashed process had any message ports.
for (MessagePorts::iterator iter = message_ports_.begin();
iter != message_ports_.end();) {
@@ -86,7 +85,7 @@ void MessagePortService::OnMessagePortMessageFilterClosing(
}
void MessagePortService::Create(int route_id,
- MessagePortMessageFilter* filter,
+ MessagePortHandler* filter,
int* message_port_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
*message_port_id = ++next_message_port_id_;
@@ -188,22 +187,9 @@ void MessagePortService::PostMessageTo(
return;
}
- // If a message port was sent around, the new location will need a routing
- // id. Instead of having the created port send us a sync message to get it,
- // send along with the message.
- std::vector<int> new_routing_ids(sent_message_port_ids.size());
- for (size_t i = 0; i < sent_message_port_ids.size(); ++i) {
- new_routing_ids[i] = entangled_port.filter->GetNextRoutingID();
- sent_ports[i]->filter = entangled_port.filter;
-
- // Update the entry for the sent port as it can be in a different process.
- sent_ports[i]->route_id = new_routing_ids[i];
- }
-
// Now send the message to the entangled port.
- entangled_port.filter->Send(new MessagePortMsg_Message(
- entangled_port.route_id, message, sent_message_port_ids,
- new_routing_ids));
+ entangled_port.filter->SendMessage(entangled_port.route_id, message,
+ sent_message_port_ids);
}
void MessagePortService::QueueMessages(int message_port_id) {
@@ -214,7 +200,7 @@ void MessagePortService::QueueMessages(int message_port_id) {
MessagePort& port = message_ports_[message_port_id];
if (port.filter) {
- port.filter->Send(new MessagePortMsg_MessagesQueued(port.route_id));
+ port.filter->SendMessagesQueued(port.route_id);
port.queue_for_inflight_messages = true;
port.filter = NULL;
}
« no previous file with comments | « content/browser/message_port_service.h ('k') | content/browser/service_worker/navigator_connect_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698