SharedMemoryABI: Make ChunkID a uint32_t
In a recent offline discussion we realized that 16 bit is too short
for a ChunkID and could cause ambiguities in the (upcoming) buffer
management logic. This CL bumps it to 32-bit and adjusts the shmem
ABI, without changing the total size of the page and chunk headers.
32 bits should cover all our realistic needs. It's unrealistic that
a probobuf message will be >> 4 GB. The size-fields we reserve for
nested messages a 4 byte varint (which gives 7 bits * 4 = 28 bits).
Even the official protobuf library itself uses "int" for representing
the size of messages. Furthermore the official protobuf implementation
caps a message size to 64 MB (see [1])
[1] https://groups.google.com/forum/#!topic/protobuf/7idXKu-dpwo
Test: perfetto_unittests
Bug: 73612642
Change-Id: Ia09d3e05064c38b0fb1c3431c9bbcfc415618d09
diff --git a/src/tracing/core/trace_writer_impl_unittest.cc b/src/tracing/core/trace_writer_impl_unittest.cc
index 3fe5b47..3b65448 100644
--- a/src/tracing/core/trace_writer_impl_unittest.cc
+++ b/src/tracing/core/trace_writer_impl_unittest.cc
@@ -83,7 +83,7 @@
auto chunk = abi->TryAcquireChunkForReading(page_idx, chunk_idx, kBufId);
if (!chunk.is_valid())
continue;
- packets_count += chunk.header()->packets_state.load().count;
+ packets_count += chunk.header()->packets.load().count;
}
}
EXPECT_EQ(kNumPackets, packets_count);