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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/native_support/process.mojom.dart

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2014 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 library process_mojom;
6
7 import 'dart:async';
8
9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core;
11 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom;
12 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom;
13
14
15
16 class ProcessSpawnParams extends bindings.Struct {
17 static const List<bindings.StructDataHeader> kVersions = const [
18 const bindings.StructDataHeader(64, 0)
19 ];
20 String path = null;
21 List<String> argv = null;
22 List<String> envp = null;
23 Object stdinFile = null;
24 Object stdoutFile = null;
25 Object stderrFile = null;
26 Object processController = null;
27
28 ProcessSpawnParams() : super(kVersions.last.size);
29
30 static ProcessSpawnParams deserialize(bindings.Message message) {
31 var decoder = new bindings.Decoder(message);
32 var result = decode(decoder);
33 if (decoder.excessHandles != null) {
34 decoder.excessHandles.forEach((h) => h.close());
35 }
36 return result;
37 }
38
39 static ProcessSpawnParams decode(bindings.Decoder decoder0) {
40 if (decoder0 == null) {
41 return null;
42 }
43 ProcessSpawnParams result = new ProcessSpawnParams();
44
45 var mainDataHeader = decoder0.decodeStructDataHeader();
46 if (mainDataHeader.version <= kVersions.last.version) {
47 // Scan in reverse order to optimize for more recent versions.
48 for (int i = kVersions.length - 1; i >= 0; --i) {
49 if (mainDataHeader.version >= kVersions[i].version) {
50 if (mainDataHeader.size == kVersions[i].size) {
51 // Found a match.
52 break;
53 }
54 throw new bindings.MojoCodecError(
55 'Header size doesn\'t correspond to known version size.');
56 }
57 }
58 } else if (mainDataHeader.size < kVersions.last.size) {
59 throw new bindings.MojoCodecError(
60 'Message newer than the last known version cannot be shorter than '
61 'required by the last known version.');
62 }
63 if (mainDataHeader.version >= 0) {
64
65 result.path = decoder0.decodeString(8, false);
66 }
67 if (mainDataHeader.version >= 0) {
68
69 var decoder1 = decoder0.decodePointer(16, true);
70 if (decoder1 == null) {
71 result.argv = null;
72 } else {
73 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified ArrayLength);
74 result.argv = new List<String>(si1.numElements);
75 for (int i1 = 0; i1 < si1.numElements; ++i1) {
76
77 result.argv[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHead erSize + bindings.kPointerSize * i1, false);
78 }
79 }
80 }
81 if (mainDataHeader.version >= 0) {
82
83 var decoder1 = decoder0.decodePointer(24, true);
84 if (decoder1 == null) {
85 result.envp = null;
86 } else {
87 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified ArrayLength);
88 result.envp = new List<String>(si1.numElements);
89 for (int i1 = 0; i1 < si1.numElements; ++i1) {
90
91 result.envp[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHead erSize + bindings.kPointerSize * i1, false);
92 }
93 }
94 }
95 if (mainDataHeader.version >= 0) {
96
97 result.stdinFile = decoder0.decodeServiceInterface(32, true, file_mojom.Fi leProxy.newFromEndpoint);
98 }
99 if (mainDataHeader.version >= 0) {
100
101 result.stdoutFile = decoder0.decodeServiceInterface(40, true, file_mojom.F ileProxy.newFromEndpoint);
102 }
103 if (mainDataHeader.version >= 0) {
104
105 result.stderrFile = decoder0.decodeServiceInterface(48, true, file_mojom.F ileProxy.newFromEndpoint);
106 }
107 if (mainDataHeader.version >= 0) {
108
109 result.processController = decoder0.decodeInterfaceRequest(56, false, Proc essControllerStub.newFromEndpoint);
110 }
111 return result;
112 }
113
114 void encode(bindings.Encoder encoder) {
115 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
116
117 encoder0.encodeString(path, 8, false);
118
119 if (argv == null) {
120 encoder0.encodeNullPointer(16, true);
121 } else {
122 var encoder1 = encoder0.encodePointerArray(argv.length, 16, bindings.kUnsp ecifiedArrayLength);
123 for (int i0 = 0; i0 < argv.length; ++i0) {
124
125 encoder1.encodeString(argv[i0], bindings.ArrayDataHeader.kHeaderSize + b indings.kPointerSize * i0, false);
126 }
127 }
128
129 if (envp == null) {
130 encoder0.encodeNullPointer(24, true);
131 } else {
132 var encoder1 = encoder0.encodePointerArray(envp.length, 24, bindings.kUnsp ecifiedArrayLength);
133 for (int i0 = 0; i0 < envp.length; ++i0) {
134
135 encoder1.encodeString(envp[i0], bindings.ArrayDataHeader.kHeaderSize + b indings.kPointerSize * i0, false);
136 }
137 }
138
139 encoder0.encodeInterface(stdinFile, 32, true);
140
141 encoder0.encodeInterface(stdoutFile, 40, true);
142
143 encoder0.encodeInterface(stderrFile, 48, true);
144
145 encoder0.encodeInterfaceRequest(processController, 56, false);
146 }
147
148 String toString() {
149 return "ProcessSpawnParams("
150 "path: $path" ", "
151 "argv: $argv" ", "
152 "envp: $envp" ", "
153 "stdinFile: $stdinFile" ", "
154 "stdoutFile: $stdoutFile" ", "
155 "stderrFile: $stderrFile" ", "
156 "processController: $processController" ")";
157 }
158
159 Map toJson() {
160 throw new bindings.MojoCodecError(
161 'Object containing handles cannot be encoded to JSON.');
162 }
163 }
164
165
166 class ProcessSpawnResponseParams extends bindings.Struct {
167 static const List<bindings.StructDataHeader> kVersions = const [
168 const bindings.StructDataHeader(16, 0)
169 ];
170 types_mojom.Error error = null;
171
172 ProcessSpawnResponseParams() : super(kVersions.last.size);
173
174 static ProcessSpawnResponseParams deserialize(bindings.Message message) {
175 var decoder = new bindings.Decoder(message);
176 var result = decode(decoder);
177 if (decoder.excessHandles != null) {
178 decoder.excessHandles.forEach((h) => h.close());
179 }
180 return result;
181 }
182
183 static ProcessSpawnResponseParams decode(bindings.Decoder decoder0) {
184 if (decoder0 == null) {
185 return null;
186 }
187 ProcessSpawnResponseParams result = new ProcessSpawnResponseParams();
188
189 var mainDataHeader = decoder0.decodeStructDataHeader();
190 if (mainDataHeader.version <= kVersions.last.version) {
191 // Scan in reverse order to optimize for more recent versions.
192 for (int i = kVersions.length - 1; i >= 0; --i) {
193 if (mainDataHeader.version >= kVersions[i].version) {
194 if (mainDataHeader.size == kVersions[i].size) {
195 // Found a match.
196 break;
197 }
198 throw new bindings.MojoCodecError(
199 'Header size doesn\'t correspond to known version size.');
200 }
201 }
202 } else if (mainDataHeader.size < kVersions.last.size) {
203 throw new bindings.MojoCodecError(
204 'Message newer than the last known version cannot be shorter than '
205 'required by the last known version.');
206 }
207 if (mainDataHeader.version >= 0) {
208
209 result.error = types_mojom.Error.decode(decoder0, 8);
210 if (result.error == null) {
211 throw new bindings.MojoCodecError(
212 'Trying to decode null union for non-nullable types_mojom.Error.');
213 }
214 }
215 return result;
216 }
217
218 void encode(bindings.Encoder encoder) {
219 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
220
221 encoder0.encodeEnum(error, 8);
222 }
223
224 String toString() {
225 return "ProcessSpawnResponseParams("
226 "error: $error" ")";
227 }
228
229 Map toJson() {
230 Map map = new Map();
231 map["error"] = error;
232 return map;
233 }
234 }
235
236
237 class ProcessSpawnWithTerminalParams extends bindings.Struct {
238 static const List<bindings.StructDataHeader> kVersions = const [
239 const bindings.StructDataHeader(48, 0)
240 ];
241 String path = null;
242 List<String> argv = null;
243 List<String> envp = null;
244 Object terminalFile = null;
245 Object processController = null;
246
247 ProcessSpawnWithTerminalParams() : super(kVersions.last.size);
248
249 static ProcessSpawnWithTerminalParams deserialize(bindings.Message message) {
250 var decoder = new bindings.Decoder(message);
251 var result = decode(decoder);
252 if (decoder.excessHandles != null) {
253 decoder.excessHandles.forEach((h) => h.close());
254 }
255 return result;
256 }
257
258 static ProcessSpawnWithTerminalParams decode(bindings.Decoder decoder0) {
259 if (decoder0 == null) {
260 return null;
261 }
262 ProcessSpawnWithTerminalParams result = new ProcessSpawnWithTerminalParams() ;
263
264 var mainDataHeader = decoder0.decodeStructDataHeader();
265 if (mainDataHeader.version <= kVersions.last.version) {
266 // Scan in reverse order to optimize for more recent versions.
267 for (int i = kVersions.length - 1; i >= 0; --i) {
268 if (mainDataHeader.version >= kVersions[i].version) {
269 if (mainDataHeader.size == kVersions[i].size) {
270 // Found a match.
271 break;
272 }
273 throw new bindings.MojoCodecError(
274 'Header size doesn\'t correspond to known version size.');
275 }
276 }
277 } else if (mainDataHeader.size < kVersions.last.size) {
278 throw new bindings.MojoCodecError(
279 'Message newer than the last known version cannot be shorter than '
280 'required by the last known version.');
281 }
282 if (mainDataHeader.version >= 0) {
283
284 result.path = decoder0.decodeString(8, false);
285 }
286 if (mainDataHeader.version >= 0) {
287
288 var decoder1 = decoder0.decodePointer(16, true);
289 if (decoder1 == null) {
290 result.argv = null;
291 } else {
292 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified ArrayLength);
293 result.argv = new List<String>(si1.numElements);
294 for (int i1 = 0; i1 < si1.numElements; ++i1) {
295
296 result.argv[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHead erSize + bindings.kPointerSize * i1, false);
297 }
298 }
299 }
300 if (mainDataHeader.version >= 0) {
301
302 var decoder1 = decoder0.decodePointer(24, true);
303 if (decoder1 == null) {
304 result.envp = null;
305 } else {
306 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified ArrayLength);
307 result.envp = new List<String>(si1.numElements);
308 for (int i1 = 0; i1 < si1.numElements; ++i1) {
309
310 result.envp[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHead erSize + bindings.kPointerSize * i1, false);
311 }
312 }
313 }
314 if (mainDataHeader.version >= 0) {
315
316 result.terminalFile = decoder0.decodeServiceInterface(32, false, file_mojo m.FileProxy.newFromEndpoint);
317 }
318 if (mainDataHeader.version >= 0) {
319
320 result.processController = decoder0.decodeInterfaceRequest(40, false, Proc essControllerStub.newFromEndpoint);
321 }
322 return result;
323 }
324
325 void encode(bindings.Encoder encoder) {
326 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
327
328 encoder0.encodeString(path, 8, false);
329
330 if (argv == null) {
331 encoder0.encodeNullPointer(16, true);
332 } else {
333 var encoder1 = encoder0.encodePointerArray(argv.length, 16, bindings.kUnsp ecifiedArrayLength);
334 for (int i0 = 0; i0 < argv.length; ++i0) {
335
336 encoder1.encodeString(argv[i0], bindings.ArrayDataHeader.kHeaderSize + b indings.kPointerSize * i0, false);
337 }
338 }
339
340 if (envp == null) {
341 encoder0.encodeNullPointer(24, true);
342 } else {
343 var encoder1 = encoder0.encodePointerArray(envp.length, 24, bindings.kUnsp ecifiedArrayLength);
344 for (int i0 = 0; i0 < envp.length; ++i0) {
345
346 encoder1.encodeString(envp[i0], bindings.ArrayDataHeader.kHeaderSize + b indings.kPointerSize * i0, false);
347 }
348 }
349
350 encoder0.encodeInterface(terminalFile, 32, false);
351
352 encoder0.encodeInterfaceRequest(processController, 40, false);
353 }
354
355 String toString() {
356 return "ProcessSpawnWithTerminalParams("
357 "path: $path" ", "
358 "argv: $argv" ", "
359 "envp: $envp" ", "
360 "terminalFile: $terminalFile" ", "
361 "processController: $processController" ")";
362 }
363
364 Map toJson() {
365 throw new bindings.MojoCodecError(
366 'Object containing handles cannot be encoded to JSON.');
367 }
368 }
369
370
371 class ProcessSpawnWithTerminalResponseParams extends bindings.Struct {
372 static const List<bindings.StructDataHeader> kVersions = const [
373 const bindings.StructDataHeader(16, 0)
374 ];
375 types_mojom.Error error = null;
376
377 ProcessSpawnWithTerminalResponseParams() : super(kVersions.last.size);
378
379 static ProcessSpawnWithTerminalResponseParams deserialize(bindings.Message mes sage) {
380 var decoder = new bindings.Decoder(message);
381 var result = decode(decoder);
382 if (decoder.excessHandles != null) {
383 decoder.excessHandles.forEach((h) => h.close());
384 }
385 return result;
386 }
387
388 static ProcessSpawnWithTerminalResponseParams decode(bindings.Decoder decoder0 ) {
389 if (decoder0 == null) {
390 return null;
391 }
392 ProcessSpawnWithTerminalResponseParams result = new ProcessSpawnWithTerminal ResponseParams();
393
394 var mainDataHeader = decoder0.decodeStructDataHeader();
395 if (mainDataHeader.version <= kVersions.last.version) {
396 // Scan in reverse order to optimize for more recent versions.
397 for (int i = kVersions.length - 1; i >= 0; --i) {
398 if (mainDataHeader.version >= kVersions[i].version) {
399 if (mainDataHeader.size == kVersions[i].size) {
400 // Found a match.
401 break;
402 }
403 throw new bindings.MojoCodecError(
404 'Header size doesn\'t correspond to known version size.');
405 }
406 }
407 } else if (mainDataHeader.size < kVersions.last.size) {
408 throw new bindings.MojoCodecError(
409 'Message newer than the last known version cannot be shorter than '
410 'required by the last known version.');
411 }
412 if (mainDataHeader.version >= 0) {
413
414 result.error = types_mojom.Error.decode(decoder0, 8);
415 if (result.error == null) {
416 throw new bindings.MojoCodecError(
417 'Trying to decode null union for non-nullable types_mojom.Error.');
418 }
419 }
420 return result;
421 }
422
423 void encode(bindings.Encoder encoder) {
424 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
425
426 encoder0.encodeEnum(error, 8);
427 }
428
429 String toString() {
430 return "ProcessSpawnWithTerminalResponseParams("
431 "error: $error" ")";
432 }
433
434 Map toJson() {
435 Map map = new Map();
436 map["error"] = error;
437 return map;
438 }
439 }
440
441
442 class ProcessControllerWaitParams extends bindings.Struct {
443 static const List<bindings.StructDataHeader> kVersions = const [
444 const bindings.StructDataHeader(8, 0)
445 ];
446
447 ProcessControllerWaitParams() : super(kVersions.last.size);
448
449 static ProcessControllerWaitParams deserialize(bindings.Message message) {
450 var decoder = new bindings.Decoder(message);
451 var result = decode(decoder);
452 if (decoder.excessHandles != null) {
453 decoder.excessHandles.forEach((h) => h.close());
454 }
455 return result;
456 }
457
458 static ProcessControllerWaitParams decode(bindings.Decoder decoder0) {
459 if (decoder0 == null) {
460 return null;
461 }
462 ProcessControllerWaitParams result = new ProcessControllerWaitParams();
463
464 var mainDataHeader = decoder0.decodeStructDataHeader();
465 if (mainDataHeader.version <= kVersions.last.version) {
466 // Scan in reverse order to optimize for more recent versions.
467 for (int i = kVersions.length - 1; i >= 0; --i) {
468 if (mainDataHeader.version >= kVersions[i].version) {
469 if (mainDataHeader.size == kVersions[i].size) {
470 // Found a match.
471 break;
472 }
473 throw new bindings.MojoCodecError(
474 'Header size doesn\'t correspond to known version size.');
475 }
476 }
477 } else if (mainDataHeader.size < kVersions.last.size) {
478 throw new bindings.MojoCodecError(
479 'Message newer than the last known version cannot be shorter than '
480 'required by the last known version.');
481 }
482 return result;
483 }
484
485 void encode(bindings.Encoder encoder) {
486 encoder.getStructEncoderAtOffset(kVersions.last);
487 }
488
489 String toString() {
490 return "ProcessControllerWaitParams("")";
491 }
492
493 Map toJson() {
494 Map map = new Map();
495 return map;
496 }
497 }
498
499
500 class ProcessControllerWaitResponseParams extends bindings.Struct {
501 static const List<bindings.StructDataHeader> kVersions = const [
502 const bindings.StructDataHeader(16, 0)
503 ];
504 types_mojom.Error error = null;
505 int exitStatus = 0;
506
507 ProcessControllerWaitResponseParams() : super(kVersions.last.size);
508
509 static ProcessControllerWaitResponseParams deserialize(bindings.Message messag e) {
510 var decoder = new bindings.Decoder(message);
511 var result = decode(decoder);
512 if (decoder.excessHandles != null) {
513 decoder.excessHandles.forEach((h) => h.close());
514 }
515 return result;
516 }
517
518 static ProcessControllerWaitResponseParams decode(bindings.Decoder decoder0) {
519 if (decoder0 == null) {
520 return null;
521 }
522 ProcessControllerWaitResponseParams result = new ProcessControllerWaitRespon seParams();
523
524 var mainDataHeader = decoder0.decodeStructDataHeader();
525 if (mainDataHeader.version <= kVersions.last.version) {
526 // Scan in reverse order to optimize for more recent versions.
527 for (int i = kVersions.length - 1; i >= 0; --i) {
528 if (mainDataHeader.version >= kVersions[i].version) {
529 if (mainDataHeader.size == kVersions[i].size) {
530 // Found a match.
531 break;
532 }
533 throw new bindings.MojoCodecError(
534 'Header size doesn\'t correspond to known version size.');
535 }
536 }
537 } else if (mainDataHeader.size < kVersions.last.size) {
538 throw new bindings.MojoCodecError(
539 'Message newer than the last known version cannot be shorter than '
540 'required by the last known version.');
541 }
542 if (mainDataHeader.version >= 0) {
543
544 result.error = types_mojom.Error.decode(decoder0, 8);
545 if (result.error == null) {
546 throw new bindings.MojoCodecError(
547 'Trying to decode null union for non-nullable types_mojom.Error.');
548 }
549 }
550 if (mainDataHeader.version >= 0) {
551
552 result.exitStatus = decoder0.decodeInt32(12);
553 }
554 return result;
555 }
556
557 void encode(bindings.Encoder encoder) {
558 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
559
560 encoder0.encodeEnum(error, 8);
561
562 encoder0.encodeInt32(exitStatus, 12);
563 }
564
565 String toString() {
566 return "ProcessControllerWaitResponseParams("
567 "error: $error" ", "
568 "exitStatus: $exitStatus" ")";
569 }
570
571 Map toJson() {
572 Map map = new Map();
573 map["error"] = error;
574 map["exitStatus"] = exitStatus;
575 return map;
576 }
577 }
578
579
580 class ProcessControllerKillParams extends bindings.Struct {
581 static const List<bindings.StructDataHeader> kVersions = const [
582 const bindings.StructDataHeader(16, 0)
583 ];
584 int signal = 0;
585
586 ProcessControllerKillParams() : super(kVersions.last.size);
587
588 static ProcessControllerKillParams deserialize(bindings.Message message) {
589 var decoder = new bindings.Decoder(message);
590 var result = decode(decoder);
591 if (decoder.excessHandles != null) {
592 decoder.excessHandles.forEach((h) => h.close());
593 }
594 return result;
595 }
596
597 static ProcessControllerKillParams decode(bindings.Decoder decoder0) {
598 if (decoder0 == null) {
599 return null;
600 }
601 ProcessControllerKillParams result = new ProcessControllerKillParams();
602
603 var mainDataHeader = decoder0.decodeStructDataHeader();
604 if (mainDataHeader.version <= kVersions.last.version) {
605 // Scan in reverse order to optimize for more recent versions.
606 for (int i = kVersions.length - 1; i >= 0; --i) {
607 if (mainDataHeader.version >= kVersions[i].version) {
608 if (mainDataHeader.size == kVersions[i].size) {
609 // Found a match.
610 break;
611 }
612 throw new bindings.MojoCodecError(
613 'Header size doesn\'t correspond to known version size.');
614 }
615 }
616 } else if (mainDataHeader.size < kVersions.last.size) {
617 throw new bindings.MojoCodecError(
618 'Message newer than the last known version cannot be shorter than '
619 'required by the last known version.');
620 }
621 if (mainDataHeader.version >= 0) {
622
623 result.signal = decoder0.decodeInt32(8);
624 }
625 return result;
626 }
627
628 void encode(bindings.Encoder encoder) {
629 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
630
631 encoder0.encodeInt32(signal, 8);
632 }
633
634 String toString() {
635 return "ProcessControllerKillParams("
636 "signal: $signal" ")";
637 }
638
639 Map toJson() {
640 Map map = new Map();
641 map["signal"] = signal;
642 return map;
643 }
644 }
645
646
647 class ProcessControllerKillResponseParams extends bindings.Struct {
648 static const List<bindings.StructDataHeader> kVersions = const [
649 const bindings.StructDataHeader(16, 0)
650 ];
651 types_mojom.Error error = null;
652
653 ProcessControllerKillResponseParams() : super(kVersions.last.size);
654
655 static ProcessControllerKillResponseParams deserialize(bindings.Message messag e) {
656 var decoder = new bindings.Decoder(message);
657 var result = decode(decoder);
658 if (decoder.excessHandles != null) {
659 decoder.excessHandles.forEach((h) => h.close());
660 }
661 return result;
662 }
663
664 static ProcessControllerKillResponseParams decode(bindings.Decoder decoder0) {
665 if (decoder0 == null) {
666 return null;
667 }
668 ProcessControllerKillResponseParams result = new ProcessControllerKillRespon seParams();
669
670 var mainDataHeader = decoder0.decodeStructDataHeader();
671 if (mainDataHeader.version <= kVersions.last.version) {
672 // Scan in reverse order to optimize for more recent versions.
673 for (int i = kVersions.length - 1; i >= 0; --i) {
674 if (mainDataHeader.version >= kVersions[i].version) {
675 if (mainDataHeader.size == kVersions[i].size) {
676 // Found a match.
677 break;
678 }
679 throw new bindings.MojoCodecError(
680 'Header size doesn\'t correspond to known version size.');
681 }
682 }
683 } else if (mainDataHeader.size < kVersions.last.size) {
684 throw new bindings.MojoCodecError(
685 'Message newer than the last known version cannot be shorter than '
686 'required by the last known version.');
687 }
688 if (mainDataHeader.version >= 0) {
689
690 result.error = types_mojom.Error.decode(decoder0, 8);
691 if (result.error == null) {
692 throw new bindings.MojoCodecError(
693 'Trying to decode null union for non-nullable types_mojom.Error.');
694 }
695 }
696 return result;
697 }
698
699 void encode(bindings.Encoder encoder) {
700 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
701
702 encoder0.encodeEnum(error, 8);
703 }
704
705 String toString() {
706 return "ProcessControllerKillResponseParams("
707 "error: $error" ")";
708 }
709
710 Map toJson() {
711 Map map = new Map();
712 map["error"] = error;
713 return map;
714 }
715 }
716
717 const int kProcess_spawn_name = 0;
718 const int kProcess_spawnWithTerminal_name = 1;
719
720 const String ProcessName =
721 'native_support::Process';
722
723 abstract class Process {
724 dynamic spawn(String path,List<String> argv,List<String> envp,Object stdinFile ,Object stdoutFile,Object stderrFile,Object processController,[Function response Factory = null]);
725 dynamic spawnWithTerminal(String path,List<String> argv,List<String> envp,Obje ct terminalFile,Object processController,[Function responseFactory = null]);
726
727 }
728
729
730 class ProcessProxyImpl extends bindings.Proxy {
731 ProcessProxyImpl.fromEndpoint(
732 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
733
734 ProcessProxyImpl.fromHandle(core.MojoHandle handle) :
735 super.fromHandle(handle);
736
737 ProcessProxyImpl.unbound() : super.unbound();
738
739 static ProcessProxyImpl newFromEndpoint(
740 core.MojoMessagePipeEndpoint endpoint) {
741 assert(endpoint.setDescription("For ProcessProxyImpl"));
742 return new ProcessProxyImpl.fromEndpoint(endpoint);
743 }
744
745 String get name => ProcessName;
746
747 void handleResponse(bindings.ServiceMessage message) {
748 switch (message.header.type) {
749 case kProcess_spawn_name:
750 var r = ProcessSpawnResponseParams.deserialize(
751 message.payload);
752 if (!message.header.hasRequestId) {
753 proxyError("Expected a message with a valid request Id.");
754 return;
755 }
756 Completer c = completerMap[message.header.requestId];
757 if (c == null) {
758 proxyError(
759 "Message had unknown request Id: ${message.header.requestId}");
760 return;
761 }
762 completerMap.remove(message.header.requestId);
763 if (c.isCompleted) {
764 proxyError("Response completer already completed");
765 return;
766 }
767 c.complete(r);
768 break;
769 case kProcess_spawnWithTerminal_name:
770 var r = ProcessSpawnWithTerminalResponseParams.deserialize(
771 message.payload);
772 if (!message.header.hasRequestId) {
773 proxyError("Expected a message with a valid request Id.");
774 return;
775 }
776 Completer c = completerMap[message.header.requestId];
777 if (c == null) {
778 proxyError(
779 "Message had unknown request Id: ${message.header.requestId}");
780 return;
781 }
782 completerMap.remove(message.header.requestId);
783 if (c.isCompleted) {
784 proxyError("Response completer already completed");
785 return;
786 }
787 c.complete(r);
788 break;
789 default:
790 proxyError("Unexpected message type: ${message.header.type}");
791 close(immediate: true);
792 break;
793 }
794 }
795
796 String toString() {
797 var superString = super.toString();
798 return "ProcessProxyImpl($superString)";
799 }
800 }
801
802
803 class _ProcessProxyCalls implements Process {
804 ProcessProxyImpl _proxyImpl;
805
806 _ProcessProxyCalls(this._proxyImpl);
807 dynamic spawn(String path,List<String> argv,List<String> envp,Object stdinFi le,Object stdoutFile,Object stderrFile,Object processController,[Function respon seFactory = null]) {
808 var params = new ProcessSpawnParams();
809 params.path = path;
810 params.argv = argv;
811 params.envp = envp;
812 params.stdinFile = stdinFile;
813 params.stdoutFile = stdoutFile;
814 params.stderrFile = stderrFile;
815 params.processController = processController;
816 return _proxyImpl.sendMessageWithRequestId(
817 params,
818 kProcess_spawn_name,
819 -1,
820 bindings.MessageHeader.kMessageExpectsResponse);
821 }
822 dynamic spawnWithTerminal(String path,List<String> argv,List<String> envp,Ob ject terminalFile,Object processController,[Function responseFactory = null]) {
823 var params = new ProcessSpawnWithTerminalParams();
824 params.path = path;
825 params.argv = argv;
826 params.envp = envp;
827 params.terminalFile = terminalFile;
828 params.processController = processController;
829 return _proxyImpl.sendMessageWithRequestId(
830 params,
831 kProcess_spawnWithTerminal_name,
832 -1,
833 bindings.MessageHeader.kMessageExpectsResponse);
834 }
835 }
836
837
838 class ProcessProxy implements bindings.ProxyBase {
839 final bindings.Proxy impl;
840 Process ptr;
841 final String name = ProcessName;
842
843 ProcessProxy(ProcessProxyImpl proxyImpl) :
844 impl = proxyImpl,
845 ptr = new _ProcessProxyCalls(proxyImpl);
846
847 ProcessProxy.fromEndpoint(
848 core.MojoMessagePipeEndpoint endpoint) :
849 impl = new ProcessProxyImpl.fromEndpoint(endpoint) {
850 ptr = new _ProcessProxyCalls(impl);
851 }
852
853 ProcessProxy.fromHandle(core.MojoHandle handle) :
854 impl = new ProcessProxyImpl.fromHandle(handle) {
855 ptr = new _ProcessProxyCalls(impl);
856 }
857
858 ProcessProxy.unbound() :
859 impl = new ProcessProxyImpl.unbound() {
860 ptr = new _ProcessProxyCalls(impl);
861 }
862
863 factory ProcessProxy.connectToService(
864 bindings.ServiceConnector s, String url) {
865 ProcessProxy p = new ProcessProxy.unbound();
866 s.connectToService(url, p);
867 return p;
868 }
869
870 static ProcessProxy newFromEndpoint(
871 core.MojoMessagePipeEndpoint endpoint) {
872 assert(endpoint.setDescription("For ProcessProxy"));
873 return new ProcessProxy.fromEndpoint(endpoint);
874 }
875
876 Future close({bool immediate: false}) => impl.close(immediate: immediate);
877
878 Future responseOrError(Future f) => impl.responseOrError(f);
879
880 Future get errorFuture => impl.errorFuture;
881
882 int get version => impl.version;
883
884 Future<int> queryVersion() => impl.queryVersion();
885
886 void requireVersion(int requiredVersion) {
887 impl.requireVersion(requiredVersion);
888 }
889
890 String toString() {
891 return "ProcessProxy($impl)";
892 }
893 }
894
895
896 class ProcessStub extends bindings.Stub {
897 Process _impl = null;
898
899 ProcessStub.fromEndpoint(
900 core.MojoMessagePipeEndpoint endpoint, [this._impl])
901 : super.fromEndpoint(endpoint);
902
903 ProcessStub.fromHandle(core.MojoHandle handle, [this._impl])
904 : super.fromHandle(handle);
905
906 ProcessStub.unbound() : super.unbound();
907
908 static ProcessStub newFromEndpoint(
909 core.MojoMessagePipeEndpoint endpoint) {
910 assert(endpoint.setDescription("For ProcessStub"));
911 return new ProcessStub.fromEndpoint(endpoint);
912 }
913
914 static const String name = ProcessName;
915
916
917 ProcessSpawnResponseParams _ProcessSpawnResponseParamsFactory(types_mojom.Erro r error) {
918 var result = new ProcessSpawnResponseParams();
919 result.error = error;
920 return result;
921 }
922 ProcessSpawnWithTerminalResponseParams _ProcessSpawnWithTerminalResponseParams Factory(types_mojom.Error error) {
923 var result = new ProcessSpawnWithTerminalResponseParams();
924 result.error = error;
925 return result;
926 }
927
928 dynamic handleMessage(bindings.ServiceMessage message) {
929 if (bindings.ControlMessageHandler.isControlMessage(message)) {
930 return bindings.ControlMessageHandler.handleMessage(this,
931 0,
932 message);
933 }
934 assert(_impl != null);
935 switch (message.header.type) {
936 case kProcess_spawn_name:
937 var params = ProcessSpawnParams.deserialize(
938 message.payload);
939 var response = _impl.spawn(params.path,params.argv,params.envp,params.st dinFile,params.stdoutFile,params.stderrFile,params.processController,_ProcessSpa wnResponseParamsFactory);
940 if (response is Future) {
941 return response.then((response) {
942 if (response != null) {
943 return buildResponseWithId(
944 response,
945 kProcess_spawn_name,
946 message.header.requestId,
947 bindings.MessageHeader.kMessageIsResponse);
948 }
949 });
950 } else if (response != null) {
951 return buildResponseWithId(
952 response,
953 kProcess_spawn_name,
954 message.header.requestId,
955 bindings.MessageHeader.kMessageIsResponse);
956 }
957 break;
958 case kProcess_spawnWithTerminal_name:
959 var params = ProcessSpawnWithTerminalParams.deserialize(
960 message.payload);
961 var response = _impl.spawnWithTerminal(params.path,params.argv,params.en vp,params.terminalFile,params.processController,_ProcessSpawnWithTerminalRespons eParamsFactory);
962 if (response is Future) {
963 return response.then((response) {
964 if (response != null) {
965 return buildResponseWithId(
966 response,
967 kProcess_spawnWithTerminal_name,
968 message.header.requestId,
969 bindings.MessageHeader.kMessageIsResponse);
970 }
971 });
972 } else if (response != null) {
973 return buildResponseWithId(
974 response,
975 kProcess_spawnWithTerminal_name,
976 message.header.requestId,
977 bindings.MessageHeader.kMessageIsResponse);
978 }
979 break;
980 default:
981 throw new bindings.MojoCodecError("Unexpected message name");
982 break;
983 }
984 return null;
985 }
986
987 Process get impl => _impl;
988 set impl(Process d) {
989 assert(_impl == null);
990 _impl = d;
991 }
992
993 String toString() {
994 var superString = super.toString();
995 return "ProcessStub($superString)";
996 }
997
998 int get version => 0;
999 }
1000
1001 const int kProcessController_wait_name = 0;
1002 const int kProcessController_kill_name = 1;
1003
1004 const String ProcessControllerName =
1005 'native_support::ProcessController';
1006
1007 abstract class ProcessController {
1008 dynamic wait([Function responseFactory = null]);
1009 dynamic kill(int signal,[Function responseFactory = null]);
1010
1011 }
1012
1013
1014 class ProcessControllerProxyImpl extends bindings.Proxy {
1015 ProcessControllerProxyImpl.fromEndpoint(
1016 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1017
1018 ProcessControllerProxyImpl.fromHandle(core.MojoHandle handle) :
1019 super.fromHandle(handle);
1020
1021 ProcessControllerProxyImpl.unbound() : super.unbound();
1022
1023 static ProcessControllerProxyImpl newFromEndpoint(
1024 core.MojoMessagePipeEndpoint endpoint) {
1025 assert(endpoint.setDescription("For ProcessControllerProxyImpl"));
1026 return new ProcessControllerProxyImpl.fromEndpoint(endpoint);
1027 }
1028
1029 String get name => ProcessControllerName;
1030
1031 void handleResponse(bindings.ServiceMessage message) {
1032 switch (message.header.type) {
1033 case kProcessController_wait_name:
1034 var r = ProcessControllerWaitResponseParams.deserialize(
1035 message.payload);
1036 if (!message.header.hasRequestId) {
1037 proxyError("Expected a message with a valid request Id.");
1038 return;
1039 }
1040 Completer c = completerMap[message.header.requestId];
1041 if (c == null) {
1042 proxyError(
1043 "Message had unknown request Id: ${message.header.requestId}");
1044 return;
1045 }
1046 completerMap.remove(message.header.requestId);
1047 if (c.isCompleted) {
1048 proxyError("Response completer already completed");
1049 return;
1050 }
1051 c.complete(r);
1052 break;
1053 case kProcessController_kill_name:
1054 var r = ProcessControllerKillResponseParams.deserialize(
1055 message.payload);
1056 if (!message.header.hasRequestId) {
1057 proxyError("Expected a message with a valid request Id.");
1058 return;
1059 }
1060 Completer c = completerMap[message.header.requestId];
1061 if (c == null) {
1062 proxyError(
1063 "Message had unknown request Id: ${message.header.requestId}");
1064 return;
1065 }
1066 completerMap.remove(message.header.requestId);
1067 if (c.isCompleted) {
1068 proxyError("Response completer already completed");
1069 return;
1070 }
1071 c.complete(r);
1072 break;
1073 default:
1074 proxyError("Unexpected message type: ${message.header.type}");
1075 close(immediate: true);
1076 break;
1077 }
1078 }
1079
1080 String toString() {
1081 var superString = super.toString();
1082 return "ProcessControllerProxyImpl($superString)";
1083 }
1084 }
1085
1086
1087 class _ProcessControllerProxyCalls implements ProcessController {
1088 ProcessControllerProxyImpl _proxyImpl;
1089
1090 _ProcessControllerProxyCalls(this._proxyImpl);
1091 dynamic wait([Function responseFactory = null]) {
1092 var params = new ProcessControllerWaitParams();
1093 return _proxyImpl.sendMessageWithRequestId(
1094 params,
1095 kProcessController_wait_name,
1096 -1,
1097 bindings.MessageHeader.kMessageExpectsResponse);
1098 }
1099 dynamic kill(int signal,[Function responseFactory = null]) {
1100 var params = new ProcessControllerKillParams();
1101 params.signal = signal;
1102 return _proxyImpl.sendMessageWithRequestId(
1103 params,
1104 kProcessController_kill_name,
1105 -1,
1106 bindings.MessageHeader.kMessageExpectsResponse);
1107 }
1108 }
1109
1110
1111 class ProcessControllerProxy implements bindings.ProxyBase {
1112 final bindings.Proxy impl;
1113 ProcessController ptr;
1114 final String name = ProcessControllerName;
1115
1116 ProcessControllerProxy(ProcessControllerProxyImpl proxyImpl) :
1117 impl = proxyImpl,
1118 ptr = new _ProcessControllerProxyCalls(proxyImpl);
1119
1120 ProcessControllerProxy.fromEndpoint(
1121 core.MojoMessagePipeEndpoint endpoint) :
1122 impl = new ProcessControllerProxyImpl.fromEndpoint(endpoint) {
1123 ptr = new _ProcessControllerProxyCalls(impl);
1124 }
1125
1126 ProcessControllerProxy.fromHandle(core.MojoHandle handle) :
1127 impl = new ProcessControllerProxyImpl.fromHandle(handle) {
1128 ptr = new _ProcessControllerProxyCalls(impl);
1129 }
1130
1131 ProcessControllerProxy.unbound() :
1132 impl = new ProcessControllerProxyImpl.unbound() {
1133 ptr = new _ProcessControllerProxyCalls(impl);
1134 }
1135
1136 factory ProcessControllerProxy.connectToService(
1137 bindings.ServiceConnector s, String url) {
1138 ProcessControllerProxy p = new ProcessControllerProxy.unbound();
1139 s.connectToService(url, p);
1140 return p;
1141 }
1142
1143 static ProcessControllerProxy newFromEndpoint(
1144 core.MojoMessagePipeEndpoint endpoint) {
1145 assert(endpoint.setDescription("For ProcessControllerProxy"));
1146 return new ProcessControllerProxy.fromEndpoint(endpoint);
1147 }
1148
1149 Future close({bool immediate: false}) => impl.close(immediate: immediate);
1150
1151 Future responseOrError(Future f) => impl.responseOrError(f);
1152
1153 Future get errorFuture => impl.errorFuture;
1154
1155 int get version => impl.version;
1156
1157 Future<int> queryVersion() => impl.queryVersion();
1158
1159 void requireVersion(int requiredVersion) {
1160 impl.requireVersion(requiredVersion);
1161 }
1162
1163 String toString() {
1164 return "ProcessControllerProxy($impl)";
1165 }
1166 }
1167
1168
1169 class ProcessControllerStub extends bindings.Stub {
1170 ProcessController _impl = null;
1171
1172 ProcessControllerStub.fromEndpoint(
1173 core.MojoMessagePipeEndpoint endpoint, [this._impl])
1174 : super.fromEndpoint(endpoint);
1175
1176 ProcessControllerStub.fromHandle(core.MojoHandle handle, [this._impl])
1177 : super.fromHandle(handle);
1178
1179 ProcessControllerStub.unbound() : super.unbound();
1180
1181 static ProcessControllerStub newFromEndpoint(
1182 core.MojoMessagePipeEndpoint endpoint) {
1183 assert(endpoint.setDescription("For ProcessControllerStub"));
1184 return new ProcessControllerStub.fromEndpoint(endpoint);
1185 }
1186
1187 static const String name = ProcessControllerName;
1188
1189
1190 ProcessControllerWaitResponseParams _ProcessControllerWaitResponseParamsFactor y(types_mojom.Error error, int exitStatus) {
1191 var result = new ProcessControllerWaitResponseParams();
1192 result.error = error;
1193 result.exitStatus = exitStatus;
1194 return result;
1195 }
1196 ProcessControllerKillResponseParams _ProcessControllerKillResponseParamsFactor y(types_mojom.Error error) {
1197 var result = new ProcessControllerKillResponseParams();
1198 result.error = error;
1199 return result;
1200 }
1201
1202 dynamic handleMessage(bindings.ServiceMessage message) {
1203 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1204 return bindings.ControlMessageHandler.handleMessage(this,
1205 0,
1206 message);
1207 }
1208 assert(_impl != null);
1209 switch (message.header.type) {
1210 case kProcessController_wait_name:
1211 var params = ProcessControllerWaitParams.deserialize(
1212 message.payload);
1213 var response = _impl.wait(_ProcessControllerWaitResponseParamsFactory);
1214 if (response is Future) {
1215 return response.then((response) {
1216 if (response != null) {
1217 return buildResponseWithId(
1218 response,
1219 kProcessController_wait_name,
1220 message.header.requestId,
1221 bindings.MessageHeader.kMessageIsResponse);
1222 }
1223 });
1224 } else if (response != null) {
1225 return buildResponseWithId(
1226 response,
1227 kProcessController_wait_name,
1228 message.header.requestId,
1229 bindings.MessageHeader.kMessageIsResponse);
1230 }
1231 break;
1232 case kProcessController_kill_name:
1233 var params = ProcessControllerKillParams.deserialize(
1234 message.payload);
1235 var response = _impl.kill(params.signal,_ProcessControllerKillResponsePa ramsFactory);
1236 if (response is Future) {
1237 return response.then((response) {
1238 if (response != null) {
1239 return buildResponseWithId(
1240 response,
1241 kProcessController_kill_name,
1242 message.header.requestId,
1243 bindings.MessageHeader.kMessageIsResponse);
1244 }
1245 });
1246 } else if (response != null) {
1247 return buildResponseWithId(
1248 response,
1249 kProcessController_kill_name,
1250 message.header.requestId,
1251 bindings.MessageHeader.kMessageIsResponse);
1252 }
1253 break;
1254 default:
1255 throw new bindings.MojoCodecError("Unexpected message name");
1256 break;
1257 }
1258 return null;
1259 }
1260
1261 ProcessController get impl => _impl;
1262 set impl(ProcessController d) {
1263 assert(_impl == null);
1264 _impl = d;
1265 }
1266
1267 String toString() {
1268 var superString = super.toString();
1269 return "ProcessControllerStub($superString)";
1270 }
1271
1272 int get version => 0;
1273 }
1274
1275
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698