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

Side by Side Diff: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_enums.mojom.dart

Issue 1753013002: Mojom runtime type info: New implementation for Dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: No changes to sha1s Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library test_enums_mojom; 5 library test_enums_mojom;
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:typed_data';
7 import 'package:mojo/bindings.dart' as bindings; 8 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; 9 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
9 10
10 11
11 class TestEnum extends bindings.MojoEnum { 12 class TestEnum extends bindings.MojoEnum {
12 static const TestEnum test = const TestEnum._(0); 13 static const TestEnum test = const TestEnum._(0);
13 static const TestEnum v = const TestEnum._(1); 14 static const TestEnum v = const TestEnum._(1);
14 static const TestEnum foo = const TestEnum._(2); 15 static const TestEnum foo = const TestEnum._(2);
15 static const TestEnum bar = const TestEnum._(3); 16 static const TestEnum bar = const TestEnum._(3);
16 17
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 case bar: 68 case bar:
68 return 'TestEnum.bar'; 69 return 'TestEnum.bar';
69 default: 70 default:
70 return null; 71 return null;
71 } 72 }
72 } 73 }
73 74
74 int toJson() => mojoEnumValue; 75 int toJson() => mojoEnumValue;
75 } 76 }
76 77
77 mojom_types.MojomEnum _testEnumsTestEnum() {
78 return new mojom_types.MojomEnum()
79 ..declData = (new mojom_types.DeclarationData()
80 ..shortName = 'TestEnum'
81 ..fullIdentifier = 'mojo.test.TestEnum')
82 ..values = <mojom_types.EnumValue>[
83 new mojom_types.EnumValue()
84 ..declData = (new mojom_types.DeclarationData()
85 ..shortName = 'Test')
86 ..enumTypeKey = 'test_enums_TestEnum__'
87 ..intValue = 0,
88 new mojom_types.EnumValue()
89 ..declData = (new mojom_types.DeclarationData()
90 ..shortName = 'V')
91 ..enumTypeKey = 'test_enums_TestEnum__'
92 ..intValue = 1,
93 new mojom_types.EnumValue()
94 ..declData = (new mojom_types.DeclarationData()
95 ..shortName = 'Foo')
96 ..enumTypeKey = 'test_enums_TestEnum__'
97 ..intValue = 2,
98 new mojom_types.EnumValue()
99 ..declData = (new mojom_types.DeclarationData()
100 ..shortName = 'Bar')
101 ..enumTypeKey = 'test_enums_TestEnum__'
102 ..intValue = 3,];
103 }
104
105 78
106 79
80 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ??
81 _initRuntimeTypeInfo();
107 82
108 Map<String, mojom_types.UserDefinedType> _initDescriptions() { 83 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
109 var map = new HashMap<String, mojom_types.UserDefinedType>(); 84 return getRuntimeTypeInfo().typeMap;
110 map["test_enums_TestEnum__"] =
111 new mojom_types.UserDefinedType()
112 ..enumType = _testEnumsTestEnum();
113 return map;
114 } 85 }
115 86
116 var _mojomDesc; 87 var _runtimeTypeInfo;
117 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { 88 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() {
118 if (_mojomDesc == null) { 89 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
119 _mojomDesc = _initDescriptions(); 90 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
120 } 91 // file.
121 return _mojomDesc; 92 var serializedRuntimeTypeInfo = new Uint8List.fromList(const [24,0,0,0,0,0,0,0 ,16,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0, 0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,64,0,0,0 ,0,0,0,0,16,0,0,0,1,0,0,0,8,0,0,0,0,0,0,0,35,0,0,0,27,0,0,0,84,89,80,69,95,75,69 ,89,58,109,111,106,111,46,116,101,115,116,46,84,101,115,116,69,110,117,109,0,0,0 ,0,0,24,0,0,0,1,0,0,0,16,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,16,0,0,0 ,0,0,0,0,240,0,0,0,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255, 255,48,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,72,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,8,0,0,0,84,101,115,116,69,110,117,109,26 ,0,0,0,18,0,0,0,109,111,106,111,46,116,101,115,116,46,84,101,115,116,69,110,117, 109,0,0,0,0,0,0,24,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,3,0,0,0,5,0,0,0,87,0,0,0,79,0, 0,0,47,104,111,109,101,47,114,117,100,111,109,105,110,101,114,47,109,111,106,111 ,47,115,114,99,47,109,111,106,111,47,112,117,98,108,105,99,47,105,110,116,101,11 4,102,97,99,101,115,47,98,105,110,100,105,110,103,115,47,116,101,115,116,115,47, 116,101,115,116,95,101,110,117,109,115,46,109,111,106,111,109,0,40,0,0,0,4,0,0,0 ,32,0,0,0,0,0,0,0,104,1,0,0,0,0,0,0,176,2,0,0,0,0,0,0,248,3,0,0,0,0,0,0,48,0,0,0 ,0,0,0,0,40,0,0,0,0,0,0,0,8,1,0,0,0,0,0,0,16,0,0,0,0,0,0,0,32,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,48,0,0,0,0, 0,0,0,56,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,12,0,0,0,4,0,0,0,84,69,83,84,0,0,0,0,31,0,0,0,23,0,0,0,109,111,1 06,111,46,116,101,115,116,46,84,101,115,116,69,110,117,109,46,84,69,83,84,0,24,0 ,0,0,0,0,0,0,16,0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,87,0,0,0,79,0,0,0,47,104,111,109,1 01,47,114,117,100,111,109,105,110,101,114,47,109,111,106,111,47,115,114,99,47,10 9,111,106,111,47,112,117,98,108,105,99,47,105,110,116,101,114,102,97,99,101,115, 47,98,105,110,100,105,110,103,115,47,116,101,115,116,115,47,116,101,115,116,95,1 01,110,117,109,115,46,109,111,106,111,109,0,35,0,0,0,27,0,0,0,84,89,80,69,95,75, 69,89,58,109,111,106,111,46,116,101,115,116,46,84,101,115,116,69,110,117,109,0,0 ,0,0,0,16,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,8,1,0, 0,0,0,0,0,16,0,0,0,0,0,0,0,32,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,72,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,255,255,255,255,48,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,255,255,2 55,255,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,1,0,0,0, 86,0,0,0,0,0,0,0,28,0,0,0,20,0,0,0,109,111,106,111,46,116,101,115,116,46,84,101, 115,116,69,110,117,109,46,86,0,0,0,0,24,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,4,0,0,0,1 2,0,0,0,87,0,0,0,79,0,0,0,
93 47,104,111,109,101,47,114,117,100,111,109,105,110,101,114,47,109,111,106,111,47, 115,114,99,47,109,111,106,111,47,112,117,98,108,105,99,47,105,110,116,101,114,10 2,97,99,101,115,47,98,105,110,100,105,110,103,115,47,116,101,115,116,115,47,116, 101,115,116,95,101,110,117,109,115,46,109,111,106,111,109,0,35,0,0,0,27,0,0,0,84 ,89,80,69,95,75,69,89,58,109,111,106,111,46,116,101,115,116,46,84,101,115,116,69 ,110,117,109,0,0,0,0,0,16,0,0,0,3,0,0,0,1,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,40,0,0, 0,0,0,0,0,8,1,0,0,0,0,0,0,16,0,0,0,0,0,0,0,32,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,72,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,48,0,0,0,0,0,0,0,56,0,0,0,0 ,0,0,0,255,255,255,255,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 11,0,0,0,3,0,0,0,70,79,79,0,0,0,0,0,30,0,0,0,22,0,0,0,109,111,106,111,46,116,101 ,115,116,46,84,101,115,116,69,110,117,109,46,70,79,79,0,0,24,0,0,0,0,0,0,0,16,0, 0,0,0,0,0,0,4,0,0,0,19,0,0,0,87,0,0,0,79,0,0,0,47,104,111,109,101,47,114,117,100 ,111,109,105,110,101,114,47,109,111,106,111,47,115,114,99,47,109,111,106,111,47, 112,117,98,108,105,99,47,105,110,116,101,114,102,97,99,101,115,47,98,105,110,100 ,105,110,103,115,47,116,101,115,116,115,47,116,101,115,116,95,101,110,117,109,11 5,46,109,111,106,111,109,0,35,0,0,0,27,0,0,0,84,89,80,69,95,75,69,89,58,109,111, 106,111,46,116,101,115,116,46,84,101,115,116,69,110,117,109,0,0,0,0,0,16,0,0,0,3 ,0,0,0,2,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,8,1,0,0,0,0,0,0,16,0,0, 0,0,0,0,0,32,1,0,0,0,0,0,0,3,0,0,0,0,0,0,0,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,255,255,255,255,48,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,72 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,3,0,0,0,66,65,82,0,0,0,0 ,0,30,0,0,0,22,0,0,0,109,111,106,111,46,116,101,115,116,46,84,101,115,116,69,110 ,117,109,46,66,65,82,0,0,24,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,4,0,0,0,28,0,0,0,87,0 ,0,0,79,0,0,0,47,104,111,109,101,47,114,117,100,111,109,105,110,101,114,47,109,1 11,106,111,47,115,114,99,47,109,111,106,111,47,112,117,98,108,105,99,47,105,110, 116,101,114,102,97,99,101,115,47,98,105,110,100,105,110,103,115,47,116,101,115,1 16,115,47,116,101,115,116,95,101,110,117,109,115,46,109,111,106,111,109,0,35,0,0 ,0,27,0,0,0,84,89,80,69,95,75,69,89,58,109,111,106,111,46,116,101,115,116,46,84, 101,115,116,69,110,117,109,0,0,0,0,0,16,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0]);
94
95 // Deserialize RuntimeTypeInfo
96 var bdata = new ByteData.view(serializedRuntimeTypeInfo.buffer);
97 var message = new bindings.Message(bdata, null, serializedRuntimeTypeInfo.leng th, 0);
98 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message);
99 return _runtimeTypeInfo;
122 } 100 }
123
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698