Chromium Code Reviews| Index: components/tracing/core/proto_utils.h |
| diff --git a/components/tracing/core/proto_utils.h b/components/tracing/core/proto_utils.h |
| index fdadf1a18df0b98f0f269b23c02c978c659a78c0..f81be318b7d9ba2f86d58b2520dd50c2761e6ee2 100644 |
| --- a/components/tracing/core/proto_utils.h |
| +++ b/components/tracing/core/proto_utils.h |
| @@ -24,6 +24,50 @@ enum : uint32_t { |
| kFieldTypeFixed32 = 5, |
| }; |
| +enum ProtoType : uint32_t { |
| + kProtoTypeInvalid = 0, |
| + kProtoTypeBool = 1, |
| + kProtoTypeInt32 = 2, |
| + kProtoTypeInt64 = 3, |
| + kProtoTypeUint32 = 4, |
| + kProtoTypeUint64 = 5, |
| + kProtoTypeSint32 = 6, |
| + kProtoTypeSint64 = 7, |
| + kProtoTypeFixed32 = 8, |
| + kProtoTypeFixed64 = 9, |
| + kProtoTypeSfixed32 = 10, |
| + kProtoTypeSfixed64 = 11, |
| + kProtoTypeFloat = 12, |
| + kProtoTypeDouble = 13, |
| + kProtoTypeEnum = 14, |
| + kProtoTypeString = 15, |
| + kProtoTypeBytes = 16, |
| + kProtoTypeMessage = 17, |
| +}; |
| + |
| +struct FieldReflection { |
|
Primiano Tucci (use gerrit)
2016/08/31 09:04:07
Can this have the same shape of https://developer
kraynov
2016/08/31 17:43:33
Done.
|
| + FieldReflection(const std::string& name, |
| + ProtoType type, |
| + uint32_t number, |
| + bool repeated) : name(name), |
| + type(type), |
| + number(number), |
| + repeated(repeated) { |
| + } |
| + |
| + static FieldReflection CreateInvalid() { |
| + return FieldReflection("<INVALID>", kProtoTypeInvalid, 0, false); |
| + } |
| + bool IsValid() const { |
| + return type != kProtoTypeInvalid && number > 0 && name != "<INVALID>"; |
| + } |
| + |
| + const std::string name; |
|
Primiano Tucci (use gerrit)
2016/08/31 09:04:07
const char* const
kraynov
2016/08/31 17:43:33
Done.
|
| + const ProtoType type; |
| + const uint32_t number; |
| + const bool repeated; |
| +}; |
|
Primiano Tucci (use gerrit)
2016/08/31 09:04:07
DISALLOW_COPY_AND_ASSIGN
kraynov
2016/08/31 17:43:33
Done.
|
| + |
| // Maximum message size supported: 256 MiB (4 x 7-bit due to varint encoding). |
| constexpr size_t kMessageLengthFieldSize = 4; |
| constexpr size_t kMaxMessageLength = (1u << (kMessageLengthFieldSize * 7)) - 1; |