Protozero: fall back on the heap when nesting too deep

This CL lifts the historic restriction on the max nesting
of protozero messages. It does so by removing the
stack-based |nested_message_arena_| hack and instead using
an explicit MessgeArena object that is responsible for
memory ownership of protozero Message objects.
The difference between root and nested messages is made
explicit by introducing RootMessage<T> (as opposite to
just Message<T>), which owns the storage for all the
submessages.
This CL still maintains the property of "(mostly) zero
allocations": the MessageArena 0th block is allocated
when the TraceWriterImpl is constructed an in most cases
never expanded. It gets expanded allocating new blocks
only when writing a message that is nested too deep.
Turns out the change is quite self-contained as most
tracing obtains Message objects via
TraceWriter::NewTracePacket(). The places that require
code changes are very limited.

Bug: 163125063
Bug: 125322557
Bug: crbug.com/960303
Change-Id: I8d7a313d81d0c407ef2c549ff5bc9febb30a54a0
21 files changed
tree: be13fdc3730fa12136d52820bc01fd38ca23a593
  1. bazel/
  2. build_overrides/
  3. buildtools/
  4. debian/
  5. docs/
  6. examples/
  7. gn/
  8. include/
  9. infra/
  10. protos/
  11. src/
  12. test/
  13. tools/
  14. ui/
  15. .clang-format
  16. .clang-tidy
  17. .gitignore
  18. .gn
  19. .style.yapf
  20. Android.bp
  21. Android.bp.extras
  22. BUILD
  23. BUILD.extras
  24. BUILD.gn
  25. CHANGELOG
  26. codereview.settings
  27. heapprofd.rc
  28. LICENSE
  29. METADATA
  30. MODULE_LICENSE_APACHE2
  31. OWNERS
  32. perfetto.rc
  33. PRESUBMIT.py
  34. README.chromium
  35. README.md
  36. TEST_MAPPING
  37. traced_perf.rc
  38. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.