commit | ca605c0784a4f09562bfbfe598447ab5c436fc8c | [log] [tgz] |
---|---|---|
author | Fletcher Woodruff <fletcherw@chromium.org> | Wed Jun 17 18:30:25 2020 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Jun 18 23:45:06 2020 |
tree | a228b00b76dd5c251124f268d7fc7cc4a8cbbe60 | |
parent | 60f6f41054926538ac35ca784319df547ba46447 [diff] |
system_api: add UNSPECIFIED to lorgnette enums The enums in the lorgnette proto API did not have UNSPECIFIED values for their 0 value. Because there is no way to distinguish an unset field from a 0 field in proto3, this means that our API is subtly broken. Since nothing is depending on these enums yet, make a breaking proto API change to add an UNSPECIFIED value as the 0 value in all enums. BUG=b:156499700 TEST=emerge-${board} system_api Change-Id: Ie89dfd03e2508ff61b5722087474c4946db36b83 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2250328 Reviewed-by: Benjamin Gordon <bmgordon@chromium.org> Tested-by: Fletcher Woodruff <fletcherw@chromium.org> Commit-Queue: Fletcher Woodruff <fletcherw@chromium.org> Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2 Cr-Mirrored-Commit: 65931f8481da7f9e906c50cf70dd7708deae1ee8
This directory (platform2/system_api
) contains constants and definitions like D-Bus service names that are shared between Chromium and Chromium OS.
This directory is only for things like headers and .proto files. No implementation should be added.
When writting a .proto file make sure to use:
option optimize_for = LITE_RUNTIME;
This will force usage of a lite protobuf instead of a full/heavy weight protobuf. The browser only links against the light version, so you will get cryptic link errors about missing parts of Message if you define a protobuf here and then try to use it in Chrome. Currently CrOS links against the full protobuffer library, but that might change in the future.
When declaring a protobuf, avoid use of required unless it is exactly what you mean. “Required is Forever” and very rarely should actually be used. Consult Protocol Buffer Basics: C++ for a detailed of this issue.