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

Side by Side 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, 8 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 define("mojo/public/js/lib/pipe_control_message_proxy", [
6 "mojo/public/interfaces/bindings/pipe_control_messages.mojom",
7 "mojo/public/js/codec",
8 "mojo/public/js/interface_types",
9 ], function(pipeControlMessages, codec, types) {
10
11 function constructRunOrClosePipeMessage(runOrClosePipeInput) {
12 var runOrClosePipeMessageParams = new
13 pipeControlMessages.RunOrClosePipeMessageParams();
14 runOrClosePipeMessageParams.input = runOrClosePipeInput;
15
16 var messageName = pipeControlMessages.kRunOrClosePipeMessageId;
17 var payloadSize =
18 pipeControlMessages.RunOrClosePipeMessageParams.encodedSize;
19
20 var builder = new codec.MessageBuilder(messageName, payloadSize);
21 builder.encodeStruct(pipeControlMessages.RunOrClosePipeMessageParams,
22 runOrClosePipeMessageParams);
23 var message = builder.finish();
24 message.setInterfaceId(types.kInvalidInterfaceId);
25 return message;
26 }
27
28 function PipeControlMessageProxy(receiver) {
29 this.receiver_ = receiver;
30 }
31
32 PipeControlMessageProxy.prototype.notifyPeerEndpointClosed = function(
33 interfaceId, reason) {
34 var message = this.constructPeerEndpointClosedMessage(interfaceId, reason);
35 this.receiver_.accept(message);
36 };
37
38 PipeControlMessageProxy.prototype.constructPeerEndpointClosedMessage =
39 function(interfaceId, reason) {
40 var event = new pipeControlMessages.PeerAssociatedEndpointClosedEvent();
41 event.id = interfaceId;
42 if (reason) {
43 event.disconnect_reason = new pipeControlMessages.DisconnectReason({
44 custom_reason: reason.custom_reason,
45 description: reason.description});
46 }
47 var runOrClosePipeInput = new pipeControlMessages.RunOrClosePipeInput();
48 runOrClosePipeInput.peer_associated_endpoint_closed_event = event;
49 return constructRunOrClosePipeMessage(runOrClosePipeInput);
50 };
51
52 var exports = {};
53 exports.PipeControlMessageProxy = PipeControlMessageProxy;
54
55 return exports;
56 });
OLDNEW
« 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