Chromium Code Reviews
Descriptiontracing v2: Introduce handles for safe usage of ProtoZeroMessage
This is to decouple the lifetime of a proto message from the underlying
chunk storage. It gives the following two guarantees:
- The underlying message is finalized (if still alive) if the handle
goes out of scope. Concretely this guarantees that all events are
committed to the buffer, without having to wait for the next event
in the thread.
- In Debug / DCHECK_IS_ON builds, the handle becomes null once the
underlying message is finalized. This is to enforce the append-only
API and catch mis-uses bugs early (e.g., when adding two repeated
fields, the addition of the second one will force the finalization
of the first and invalidation of its handle)
BUG=608719
TEST=ProtoZeroMessageTest.MessageHandle
Committed: https://crrev.com/4f022543fb102a9c074308cb70e85d0a4d830cd1
Cr-Commit-Position: refs/heads/master@{#406827}
Patch Set 1 #Patch Set 2 : . #
Total comments: 14
Patch Set 3 : alph+oysteine review #Patch Set 4 : final nits #
Dependent Patchsets: Messages
Total messages: 21 (14 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||