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

Unified Diff: content/browser/navigator_connect/navigator_connect_context_impl.cc

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 years, 10 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/browser/navigator_connect/navigator_connect_context_impl.cc
diff --git a/content/browser/navigator_connect/navigator_connect_context_impl.cc b/content/browser/navigator_connect/navigator_connect_context_impl.cc
index 9911b3ca05e67d24d8bc9f97ae26d7db50227bc1..35a02d1029aac29b11bf3bb8a9fc7939dc9305a4 100644
--- a/content/browser/navigator_connect/navigator_connect_context_impl.cc
+++ b/content/browser/navigator_connect/navigator_connect_context_impl.cc
@@ -68,10 +68,8 @@ void NavigatorConnectContextImpl::Connect(
if (!factory) {
// No factories found.
- // Destroy ports since connection failed.
- message_port_service->Destroy(client_port);
- message_port_service->Destroy(service_port);
- callback.Run(MSG_ROUTING_NONE, MSG_ROUTING_NONE, false);
+ OnConnectResult(client, client_port, client_port_route_id,
+ callback, nullptr);
return;
}
@@ -92,12 +90,15 @@ void NavigatorConnectContextImpl::OnConnectResult(
// Update service side port with delegate.
MessagePortService::GetInstance()->UpdateMessagePort(
client.message_port_id, delegate, client.message_port_id);
- callback.Run(client_message_port_id, client_port_route_id, true);
+ TransferredMessagePort port;
+ port.id = client_message_port_id;
+ // TODO(mek): Set port.send_value_as_messages depending on connect result.
+ callback.Run(port, client_port_route_id, true);
} else {
// Destroy ports since connection failed.
MessagePortService::GetInstance()->Destroy(client.message_port_id);
MessagePortService::GetInstance()->Destroy(client_message_port_id);
- callback.Run(MSG_ROUTING_NONE, MSG_ROUTING_NONE, false);
+ callback.Run(TransferredMessagePort(), MSG_ROUTING_NONE, false);
}
}

Powered by Google App Engine
This is Rietveld 408576698