track_event: Refuse to compile with possibly dynamic strings

https://perfetto.dev/docs/instrumentation/track-events#dynamic-event-names
says:

```
Ideally all event name should be compile time string constants. [...] If
we pass a dynamic string here, we will get compile time static_assert
failure
```

This used to be true before 3a1ed6fb6ab8("Add TraceForCategory* methods
for legacy macros"), but in that commit we broke the static_assert
mechanism (2023-03-20).

Inside PERFETTO_INTERNAL_TRACK_EVENT_WITH_METHOD, there's a
::perfetto::internal::ValidateEventNameType that's supposed to check if
the event name makes sense (either compile time constant or dynamic
string).

The problem is that we call DecayEventNameType() before calling
PERFETTO_INTERNAL_TRACK_EVENT_WITH_METHOD, so
::perfetto::internal::ValidateEventNameType only sees the decayed type.

This commit restores the mechanism for non legacy macro. For legacy
macros we have a test with:

```
TRACE_EVENT_BEGIN0("test", i % 2 ? "Odd" : "Even")
```

Which would break the static_assert. I guess legacy macros didn't have
that protection. For legacy macro we end up calling DecayEventNameType
twice, but that shouldn't be a problem.

Change-Id: I4c43fcce5d154405ea60388a95a34b9fd9b0fb24
2 files changed
tree: 502f12296163e59bbed440116035f53aaf53ace9
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. python/
  13. src/
  14. test/
  15. third_party/
  16. tools/
  17. ui/
  18. .clang-format
  19. .clang-tidy
  20. .git-blame-ignore-revs
  21. .gitattributes
  22. .gitignore
  23. .gn
  24. .style.yapf
  25. Android.bp
  26. Android.bp.extras
  27. BUILD
  28. BUILD.extras
  29. BUILD.gn
  30. CHANGELOG
  31. codereview.settings
  32. DIR_METADATA
  33. heapprofd.rc
  34. LICENSE
  35. meson.build
  36. METADATA
  37. MODULE_LICENSE_APACHE2
  38. OWNERS
  39. perfetto.rc
  40. PerfettoIntegrationTests.xml
  41. persistent_cfg.pbtxt
  42. PRESUBMIT.py
  43. README.chromium
  44. README.md
  45. TEST_MAPPING
  46. traced_perf.rc
  47. WATCHLISTS
  48. 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.