This directory contains strongly-typed wrappers (using base::TokenType<...>
) of base::UnguessableToken
for tokens that are commonly passed between browsers and renderers. The strong typing is to prevent type confusion as these tokens are passed around. To support strong typing through the entire stack (including IPC) these tokens additionally include content/
and blink/
specific typemaps, as well as Mojo struct definitions.
Suppose you want to add a new token type. You would do the following:
/third_party/blink/public/common/tokens/tokens.h
./third_party/blink/public/mojom/tokens/tokens.mojom
. Be sure to follow the convention that the struct contains a single base.mojom.UnguessableToken
member named value
./third_party/blink/public/common/tokens/tokens_mojom_traits.h
. Use the templated TokenMojomTraitsHelper<...>
helper class.mojom/tokens/BUILD.gn
and add a new typemap definition for the token to the shared_cpp_typemaps
section./content/common/content_param_traits.h
.