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

Side by Side Diff: mojo/public/interfaces/bindings/tests/test_unions.mojom

Issue 2694843003: Add field-initializing factory static methods to generated mojo unions. (Closed)
Patch Set: 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 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 module mojo.test; 5 module mojo.test;
6 6
7 enum AnEnum { 7 enum AnEnum {
8 FIRST, SECOND 8 FIRST, SECOND
9 }; 9 };
10 10
(...skipping 12 matching lines...) Expand all
23 uint32 f_uint32; 23 uint32 f_uint32;
24 int64 f_int64; 24 int64 f_int64;
25 uint64 f_uint64; 25 uint64 f_uint64;
26 float f_float; 26 float f_float;
27 double f_double; 27 double f_double;
28 bool f_bool; 28 bool f_bool;
29 AnEnum f_enum; 29 AnEnum f_enum;
30 AnExtensibleEnum f_extensible_enum; 30 AnExtensibleEnum f_extensible_enum;
31 }; 31 };
32 32
33 union PodUnionWithDuplicates {
34 int8 f_int8;
35 int8 f_int8_other;
36 uint8 f_uint8;
37 uint8 f_uint8_other;
38 int16 f_int16;
39 int16 f_int16_other;
40 uint16 f_uint16;
41 uint16 f_uint16_other;
42 int32 f_int32;
43 int32 f_int32_other;
44 uint32 f_uint32;
45 uint32 f_uint32_other;
46 int64 f_int64;
47 int64 f_int64_other;
48 uint64 f_uint64;
49 uint64 f_uint64_other;
50 float f_float;
51 float f_float_other;
52 double f_double;
53 double f_double_other;
54 bool f_bool;
55 bool f_bool_other;
56 AnEnum f_enum;
57 AnEnum f_enum_other;
58 AnExtensibleEnum f_extensible_enum;
59 AnExtensibleEnum f_extensible_enum_other;
60 };
61
33 union ObjectUnion { 62 union ObjectUnion {
34 int8 f_int8; 63 int8 f_int8;
35 string f_string; 64 string f_string;
36 DummyStruct f_dummy; 65 DummyStruct f_dummy;
37 DummyStruct? f_nullable; 66 DummyStruct? f_nullable;
38 array<int8> f_array_int8; 67 array<int8> f_array_int8;
39 map<string, int8> f_map_int8; 68 map<string, int8> f_map_int8;
40 PodUnion f_pod_union; 69 PodUnion f_pod_union;
41 // Test that Clone() is defined after SmallStruct is declared. 70 // Test that Clone() is defined after SmallStruct is declared.
42 array<SmallStruct> f_small_structs; 71 array<SmallStruct> f_small_structs;
43 }; 72 };
44 73
74 union ObjectUnionWithDuplicates {
75 string f_string;
76 string f_string_other;
77 DummyStruct f_dummy;
78 DummyStruct f_dummy_other;
79 DummyStruct? f_nullable;
80 DummyStruct? f_nullable_other;
81 array<int8> f_array_int8;
82 array<int8> f_array_int8_other;
83 map<string, int8> f_map_int8;
84 map<string, int8> f_map_int8_other;
85 PodUnion f_pod_union;
86 PodUnion f_pod_union_other;
87 // Test that Clone() is defined after SmallStruct is declared.
88 array<SmallStruct> f_small_structs;
89 array<SmallStruct> f_small_structs_other;
90 };
91
45 union HandleUnion { 92 union HandleUnion {
46 handle f_handle; 93 handle f_handle;
47 handle<message_pipe> f_message_pipe; 94 handle<message_pipe> f_message_pipe;
48 handle<data_pipe_consumer> f_data_pipe_consumer; 95 handle<data_pipe_consumer> f_data_pipe_consumer;
49 handle<data_pipe_producer> f_data_pipe_producer; 96 handle<data_pipe_producer> f_data_pipe_producer;
50 handle<shared_buffer> f_shared_buffer; 97 handle<shared_buffer> f_shared_buffer;
51 SmallCache f_small_cache; 98 SmallCache f_small_cache;
52 SmallCache& f_small_cache_request; 99 SmallCache& f_small_cache_request;
53 }; 100 };
54 101
102 union HandleUnionWithDuplicates {
103 handle f_handle;
104 handle f_handle_other;
105 handle<message_pipe> f_message_pipe;
106 handle<message_pipe> f_message_pipe_other;
107 handle<data_pipe_consumer> f_data_pipe_consumer;
108 handle<data_pipe_consumer> f_data_pipe_consumer_other;
109 handle<data_pipe_producer> f_data_pipe_producer;
110 handle<data_pipe_producer> f_data_pipe_producer_other;
111 handle<shared_buffer> f_shared_buffer;
112 handle<shared_buffer> f_shared_buffer_other;
113 SmallCache f_small_cache;
114 SmallCache f_small_cache_other;
115 SmallCache& f_small_cache_request;
116 SmallCache& f_small_cache_request_other;
117 };
118
55 struct WrapperStruct { 119 struct WrapperStruct {
56 ObjectUnion? object_union; 120 ObjectUnion? object_union;
57 PodUnion? pod_union; 121 PodUnion? pod_union;
58 HandleUnion? handle_union; 122 HandleUnion? handle_union;
59 }; 123 };
60 124
61 struct DummyStruct { 125 struct DummyStruct {
62 int8 f_int8; 126 int8 f_int8;
63 }; 127 };
64 128
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 }; 160 };
97 161
98 union OldUnion { 162 union OldUnion {
99 int8 f_int8; 163 int8 f_int8;
100 }; 164 };
101 165
102 union NewUnion { 166 union NewUnion {
103 int8 f_int8; 167 int8 f_int8;
104 int16 f_int16; 168 int16 f_int16;
105 }; 169 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698