Constexpr-eliminate GetCategoryGroupEnabled calls for popular categories

This CL allows to avoid the cost of calling GetCategoryGroupEnabled() in
TRACE_EVENT macros for popular categories, in a way that doesn't require more
macros, nor changing all the call sites.

The idea is to put all popular categories into a static global array so an
address of a category state may be determined at compile-time through a call
to a constexpr function.

This CL makes it impossible to use non constant expressions as a category name
in the tracing macros. All the call sites that don't satisfy this requirement
have to be converted. Hopefully, there aren't a lot of such callers.

This change reduces the code size generated from each trace macro by ~16 bytes,
check the full report here:
The total Android apk size savings are ~60 KiB.

Bug: 702718, 708990
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I9f7b48fd4ee614996feaabda3e5495fd9b786c3a
Commit-Queue: Alexandr Ilin <>
Reviewed-by: Scott Violet <>
Reviewed-by: Primiano Tucci <>
Reviewed-by: Tibor Goldschwendt <>
Reviewed-by: Frank Liberato <>
Reviewed-by: vmpstr <>
Reviewed-by: Sami Kyöstilä <>
Reviewed-by: David Turner <>
Cr-Commit-Position: refs/heads/master@{#607975}
73 files changed