Commit 9353d6dc authored by Ryan Sleevi's avatar Ryan Sleevi Committed by Commit Bot

Clarify how nullable types map in C++

Presently, the handling for an IDL-nullable type "Foo?" is buried
within the type mapping documentation for nullable_is_same_type,
making it easy to overlook.

Update the informational table that serves as a quick reference for
IDL to C++ types to include a note about it, as well as a reference
to the customizability.

Bug: 998985
Change-Id: If4e6609da44d1c2cbb81c32a1712d032e2c3a13a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1774330
Commit-Queue: Ryan Sleevi <rsleevi@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#691670}
parent 26195f04
......@@ -1493,8 +1493,7 @@ Let's look at each of the variables above:
`base::Optional<CppType>`. If this attribute is set, the `base::Optional`
wrapper is omitted for nullable `MojomType?` values, but the
`StructTraits` definition for this type mapping must define additional
`IsNull` and `SetToNull` methods. See
[Specializing Nullability](#Specializing-Nullability) below.
`IsNull` and `SetToNull` methods.
* `force_serialize`: The typemap is incompatible with lazy serialization
(e.g. consider a typemap to a `base::StringPiece`, where retaining a
copy is unsafe). Any messages carrying the type will be forced down the
......@@ -1558,6 +1557,7 @@ to valid getter return types:
| `FooEnum` | Value of any type that has an appropriate `EnumTraits` specialization defined. By default this inlcudes only the generated `FooEnum` type.
| `FooStruct` | Value or reference to any type that has an appropriate `StructTraits` specialization defined. By default this includes only the generated `FooStructPtr` type.
| `FooUnion` | Value of reference to any type that has an appropriate `UnionTraits` specialization defined. By default this includes only the generated `FooUnionPtr` type.
| `Foo?` | `base::Optional<CppType>`, where `CppType` is the value type defined by the appropriate traits class specialization (e.g. `StructTraits`, `mojo::MapTraits`, etc.). This may be customized by the [typemapping](#Enabling-a-New-Type-Mapping).
### Using Generated DataView Types
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment