OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package serialization | 5 package serialization |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "mojo/public/go/bindings" | 9 "mojo/public/go/bindings" |
10 "mojom/mojom_parser/generated/mojom_files" | 10 "mojom/mojom_parser/generated/mojom_files" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 func translateMojomInterface(intrfc *mojom.MojomInterface) *mojom_types.UserDefi
nedTypeInterfaceType { | 205 func translateMojomInterface(intrfc *mojom.MojomInterface) *mojom_types.UserDefi
nedTypeInterfaceType { |
206 mojomInterface := mojom_types.UserDefinedTypeInterfaceType{} | 206 mojomInterface := mojom_types.UserDefinedTypeInterfaceType{} |
207 | 207 |
208 mojomInterface.Value.DeclData = translateDeclarationData(&intrfc.Declara
tionData) | 208 mojomInterface.Value.DeclData = translateDeclarationData(&intrfc.Declara
tionData) |
209 mojomInterface.Value.DeclData.ContainedDeclarations = translateContained
Declarations(&intrfc.NestedDeclarations) | 209 mojomInterface.Value.DeclData.ContainedDeclarations = translateContained
Declarations(&intrfc.NestedDeclarations) |
210 | 210 |
211 » // TODO(rudominer) The Interface name field need not be the name from th
e .mojom file. | 211 » mojomInterface.Value.ServiceName = intrfc.ServiceName |
212 » mojomInterface.Value.InterfaceName = intrfc.SimpleName() | |
213 | 212 |
214 mojomInterface.Value.Methods = make(map[uint32]mojom_types.MojomMethod) | 213 mojomInterface.Value.Methods = make(map[uint32]mojom_types.MojomMethod) |
215 for ordinal, method := range intrfc.MethodsByOrdinal { | 214 for ordinal, method := range intrfc.MethodsByOrdinal { |
216 mojomInterface.Value.Methods[ordinal] = translateMojomMethod(met
hod) | 215 mojomInterface.Value.Methods[ordinal] = translateMojomMethod(met
hod) |
217 } | 216 } |
218 | 217 |
219 return &mojomInterface | 218 return &mojomInterface |
220 } | 219 } |
221 | 220 |
222 func translateMojomMethod(method *mojom.MojomMethod) mojom_types.MojomMethod { | 221 func translateMojomMethod(method *mojom.MojomMethod) mojom_types.MojomMethod { |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 578 |
580 // stringPointer is a convenience function for creating a pointer to a string wh
ose value | 579 // stringPointer is a convenience function for creating a pointer to a string wh
ose value |
581 // is the specified string. It may be used in situations where the compiler will | 580 // is the specified string. It may be used in situations where the compiler will |
582 // not allow you to take the address of a string value directly, such as the | 581 // not allow you to take the address of a string value directly, such as the |
583 // return value of a function. It is necessary to create pointers to strings bec
ause | 582 // return value of a function. It is necessary to create pointers to strings bec
ause |
584 // that is how the Mojom type |string?| (i.e. nullable string) is represented in | 583 // that is how the Mojom type |string?| (i.e. nullable string) is represented in |
585 // in the Mojom Go bindings. | 584 // in the Mojom Go bindings. |
586 func stringPointer(s string) *string { | 585 func stringPointer(s string) *string { |
587 return &s | 586 return &s |
588 } | 587 } |
OLD | NEW |