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

Unified Diff: mojo/public/js/lib/pipe_control_message_proxy.js

Issue 2744963002: Introduce InterfaceEndpointClient(IEC), InterfaceEndpointHandle and (Closed)
Patch Set: Throw the error with the string being the stack trace needed to debug layouts which don't output an… Created 3 years, 9 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
« no previous file with comments | « mojo/public/js/lib/pipe_control_message_handler.js ('k') | mojo/public/js/router.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/lib/pipe_control_message_proxy.js
diff --git a/mojo/public/js/lib/pipe_control_message_proxy.js b/mojo/public/js/lib/pipe_control_message_proxy.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b8e7a20ea7bbdf26a3128e26ea03be6ba78a57c
--- /dev/null
+++ b/mojo/public/js/lib/pipe_control_message_proxy.js
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define("mojo/public/js/lib/pipe_control_message_proxy", [
+ "mojo/public/interfaces/bindings/pipe_control_messages.mojom",
+ "mojo/public/js/codec",
+ "mojo/public/js/interface_types",
+], function(pipeControlMessages, codec, types) {
+
+ function constructRunOrClosePipeMessage(runOrClosePipeInput) {
+ var runOrClosePipeMessageParams = new
+ pipeControlMessages.RunOrClosePipeMessageParams();
+ runOrClosePipeMessageParams.input = runOrClosePipeInput;
+
+ var messageName = pipeControlMessages.kRunOrClosePipeMessageId;
+ var payloadSize =
+ pipeControlMessages.RunOrClosePipeMessageParams.encodedSize;
+
+ var builder = new codec.MessageBuilder(messageName, payloadSize);
+ builder.encodeStruct(pipeControlMessages.RunOrClosePipeMessageParams,
+ runOrClosePipeMessageParams);
+ var message = builder.finish();
+ message.setInterfaceId(types.kInvalidInterfaceId);
+ return message;
+ }
+
+ function PipeControlMessageProxy(receiver) {
+ this.receiver_ = receiver;
+ }
+
+ PipeControlMessageProxy.prototype.notifyPeerEndpointClosed = function(
+ interfaceId, reason) {
+ var message = this.constructPeerEndpointClosedMessage(interfaceId, reason);
+ this.receiver_.accept(message);
+ };
+
+ PipeControlMessageProxy.prototype.constructPeerEndpointClosedMessage =
+ function(interfaceId, reason) {
+ var event = new pipeControlMessages.PeerAssociatedEndpointClosedEvent();
+ event.id = interfaceId;
+ if (reason) {
+ event.disconnect_reason = new pipeControlMessages.DisconnectReason({
+ custom_reason: reason.custom_reason,
+ description: reason.description});
+ }
+ var runOrClosePipeInput = new pipeControlMessages.RunOrClosePipeInput();
+ runOrClosePipeInput.peer_associated_endpoint_closed_event = event;
+ return constructRunOrClosePipeMessage(runOrClosePipeInput);
+ };
+
+ var exports = {};
+ exports.PipeControlMessageProxy = PipeControlMessageProxy;
+
+ return exports;
+});
« no previous file with comments | « mojo/public/js/lib/pipe_control_message_handler.js ('k') | mojo/public/js/router.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698