class MessageHandleBase
Defined at line 47 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
MessageHandle allows to decouple the lifetime of a proto message
from the underlying storage. It gives the following guarantees:
- The underlying message is finalized (if still alive) if the handle goes
out of scope.
- In Debug / DCHECK_ALWAYS_ON builds, the handle becomes null once the
message is finalized. This is to enforce the append-only API. For instance
when adding two repeated messages, the addition of the 2nd one forces
the finalization of the first.
Think about this as a WeakPtr
<Message
> which calls
Message::Finalize() when going out of scope.
Public Methods
void ~MessageHandleBase ()
Defined at line 49 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
void MessageHandleBase (MessageHandleBase && other)
Move-only type.
Defined at line 59 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
MessageHandleBase & operator= (MessageHandleBase && other)
Defined at line 63 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
bool operator bool ()
Defined at line 73 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
void set_finalization_listener (MessageFinalizationListener * listener)
Defined at line 80 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
ScatteredStreamWriter * TakeStreamWriter ()
Returns a (non-owned, it should not be deleted) pointer to the
ScatteredStreamWriter used to write the message data. The Message becomes
unusable after this point.
The caller can now write directly, without using protozero::Message.
Defined at line 89 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
Protected Methods
void MessageHandleBase (Message * message)
Defined at line 100 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
Message * operator-> ()
Defined at line 108 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
Message & operator* ()
Defined at line 114 of file ../../third_party/perfetto/include/perfetto/protozero/message_handle.h
Friends
class Message