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

Unified Diff: mojom/generators/c/cgen/type_table.go

Issue 2200843002: C bindings: Implement _DeepCopy() & some unittests. (Closed) Base URL: git@github.com:domokit/mojo.git@cgen_validate
Patch Set: Mojom[Struct|Array]_DeepCopy will return bool for success/failure Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojom/generators/c/cgen/type_table.go
diff --git a/mojom/generators/c/cgen/type_table.go b/mojom/generators/c/cgen/type_table.go
index cdd8fbec86f1bdf98d4369da80c6bac95ecdc893..18b0894afddadaab39d5196ce16024d894037449 100644
--- a/mojom/generators/c/cgen/type_table.go
+++ b/mojom/generators/c/cgen/type_table.go
@@ -52,8 +52,12 @@ type StructPointerTable struct {
Entries []StructPointerTableEntry
}
type UnionPointerTable struct {
- Name string
+ Name string
+ // Entries only includes entries for pointer and handle types.
Entries []UnionPointerTableEntry
+ // The number of fields in the union (this can be used to determine valid tag
+ // numbers).
+ NumFields uint32
}
type TypeTableTemplate struct {
@@ -303,7 +307,8 @@ func (table *TypeTableTemplate) makeUnionPointerTableEntry(prefix string, tag ui
func (table *TypeTableTemplate) insertUnionPointerTable(u mojom_types.MojomUnion) {
unionTablePrefix := mojomToCName(*u.DeclData.FullIdentifier)
unionTable := UnionPointerTable{
- Name: unionTablePrefix + "__TypeDesc",
+ Name: unionTablePrefix + "__TypeDesc",
+ NumFields: uint32(len(u.Fields)),
}
for _, field := range u.Fields {
if table.isPointerOrHandle(field.Type) {

Powered by Google App Engine
This is Rietveld 408576698