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

Unified Diff: mojo/edk/system/channel.cc

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC 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
« no previous file with comments | « mojo/edk/system/channel.h ('k') | mojo/edk/system/core.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel.cc
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc
index a7162ddbdb0f77dcc15182ad554fdc24dbac5f5f..8889919992a9e2949561b7c73c66016040cf3f34 100644
--- a/mojo/edk/system/channel.cc
+++ b/mojo/edk/system/channel.cc
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/endpoint_relayer.h"
#include "mojo/edk/system/transport_data.h"
namespace mojo {
@@ -185,12 +186,56 @@ size_t Channel::GetSerializedEndpointSize() const {
return sizeof(SerializedEndpoint);
}
-void Channel::SerializeEndpoint(scoped_refptr<ChannelEndpoint> endpoint,
- void* destination) {
+void Channel::SerializeEndpointWithClosedPeer(
+ void* destination,
+ MessageInTransitQueue* message_queue) {
+ // We can actually just pass no client to |SerializeEndpointWithLocalPeer()|.
+ SerializeEndpointWithLocalPeer(destination, message_queue, nullptr, 0);
+}
+
+scoped_refptr<ChannelEndpoint> Channel::SerializeEndpointWithLocalPeer(
+ void* destination,
+ MessageInTransitQueue* message_queue,
+ ChannelEndpointClient* endpoint_client,
+ unsigned endpoint_client_port) {
+ DCHECK(destination);
+ // Allow |endpoint_client| to be null, for use by
+ // |SerializeEndpointWithClosedPeer()|.
+
+ scoped_refptr<ChannelEndpoint> endpoint(new ChannelEndpoint(
+ endpoint_client, endpoint_client_port, message_queue));
+
+ SerializedEndpoint* s = static_cast<SerializedEndpoint*>(destination);
+ s->receiver_endpoint_id = AttachAndRunEndpoint(endpoint);
+ DVLOG(2) << "Serializing endpoint with local or closed peer (remote ID = "
+ << s->receiver_endpoint_id << ")";
+
+ return endpoint;
+}
+
+void Channel::SerializeEndpointWithRemotePeer(
+ void* destination,
+ MessageInTransitQueue* message_queue,
+ scoped_refptr<ChannelEndpoint> peer_endpoint) {
+ DCHECK(destination);
+ DCHECK(peer_endpoint);
+
+ DLOG(WARNING) << "Direct message pipe passing across multiple channels not "
+ "yet implemented; will proxy";
+ // Create and set up an |EndpointRelayer| to proxy.
+ // TODO(vtl): If we were to own/track the relayer directly (rather than owning
+ // it via its |ChannelEndpoint|s), then we might be able to make
+ // |ChannelEndpoint|'s |client_| pointer a raw pointer.
+ scoped_refptr<EndpointRelayer> relayer(new EndpointRelayer());
+ scoped_refptr<ChannelEndpoint> endpoint(
+ new ChannelEndpoint(relayer.get(), 0, message_queue));
+ relayer->Init(endpoint.get(), peer_endpoint.get());
+ peer_endpoint->ReplaceClient(relayer.get(), 1);
+
SerializedEndpoint* s = static_cast<SerializedEndpoint*>(destination);
s->receiver_endpoint_id = AttachAndRunEndpoint(endpoint);
- DVLOG(2) << "Serializing endpoint (remote ID = " << s->receiver_endpoint_id
- << ")";
+ DVLOG(2) << "Serializing endpoint with remote peer (remote ID = "
+ << s->receiver_endpoint_id << ")";
}
scoped_refptr<IncomingEndpoint> Channel::DeserializeEndpoint(
« no previous file with comments | « mojo/edk/system/channel.h ('k') | mojo/edk/system/core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698