| Index: components/tracing/core/proto_zero_message.h
|
| diff --git a/components/tracing/core/proto_zero_message.h b/components/tracing/core/proto_zero_message.h
|
| index 7f6509387c4289a9fc947dd955c4e7a2ae5cda0b..d7fe1d4270e5a99474e940091f39dd69ac5ee4bf 100644
|
| --- a/components/tracing/core/proto_zero_message.h
|
| +++ b/components/tracing/core/proto_zero_message.h
|
| @@ -21,12 +21,17 @@
|
| namespace tracing {
|
| namespace v2 {
|
|
|
| +class ProtoZeroMessageHandleBase;
|
| +
|
| // Base class extended by the proto C++ stubs generated by the ProtoZero
|
| // compiler (see //components/tracing/tools/). This class provides the minimal
|
| // runtime required to support append-only operations and is desiged for
|
| // performance. None of the methods require any dynamic memory allocation.
|
| class TRACING_EXPORT ProtoZeroMessage {
|
| public:
|
| + // Clears up the state, allowing the message to be reused as a fresh one.
|
| + void Reset(ScatteredStreamWriter*);
|
| +
|
| // Commits all the changes to the buffer (backfills the size field of this and
|
| // all nested messages) and seals the message. Returns the size of the message
|
| // (and all nested sub-messages), without taking into account any chunking.
|
| @@ -48,12 +53,14 @@ class TRACING_EXPORT ProtoZeroMessage {
|
| // partial size that lies in the last chunk has to be backfilled.
|
| void inc_size_already_written(size_t size) { size_already_written_ += size; }
|
|
|
| +#if DCHECK_IS_ON()
|
| + // Only for ProtoZeroMessageHandleBase.
|
| + void set_handle(ProtoZeroMessageHandleBase* handle) { handle_ = handle; }
|
| +#endif
|
| +
|
| protected:
|
| ProtoZeroMessage();
|
|
|
| - // Clears up the state, allowing the message to be reused as a fresh one.
|
| - void Reset(ScatteredStreamWriter*);
|
| -
|
| void AppendVarIntU64(uint32_t field_id, uint64_t value);
|
| void AppendVarIntU32(uint32_t field_id, uint32_t value);
|
| void AppendFloat(uint32_t field_id, float value);
|
| @@ -87,6 +94,7 @@ class TRACING_EXPORT ProtoZeroMessage {
|
| FRIEND_TEST_ALL_PREFIXES(ProtoZeroMessageTest, BackfillSizeOnFinalization);
|
| FRIEND_TEST_ALL_PREFIXES(ProtoZeroMessageTest, NestedMessagesSimple);
|
| FRIEND_TEST_ALL_PREFIXES(ProtoZeroMessageTest, StressTest);
|
| + FRIEND_TEST_ALL_PREFIXES(ProtoZeroMessageTest, MessageHandle);
|
|
|
| enum : uint32_t { kMaxNestingDepth = 8 };
|
|
|
| @@ -125,6 +133,8 @@ class TRACING_EXPORT ProtoZeroMessage {
|
| // When true, no more changes to the message are allowed. This is to DCHECK
|
| // attempts of writing to a message which has been Finalize()-d.
|
| bool sealed_;
|
| +
|
| + ProtoZeroMessageHandleBase* handle_;
|
| #endif
|
|
|
| // Pointer to the last child message created through BeginNestedMessage(), if
|
|
|