TracedValue: add dchecks that the scope is always correct.
Each time a value is being written into a TracedValue / TracedArray
/ TracedDictionary, DCHECK that it's an active one.
Active bit is tracked on each scope in the following way:
- When calling Write* for primitive types, active bit is passed back
to the parent.
- When calling Write* for complex types, active bit is passed to the
newly-created scope.
- When destroying the scope, active bit is passed back to the parent.
Also add a few death tests checking that the dchecks actually fail.
R=primiano@google.com,eseckler@google.com,skyostil@google.com
Change-Id: Iab5122a2317c2ea7ad646039ea6e40a6fe7195ba
diff --git a/BUILD b/BUILD
index 3303844..256f5f5 100644
--- a/BUILD
+++ b/BUILD
@@ -513,6 +513,7 @@
"include/perfetto/tracing/event_context.h",
"include/perfetto/tracing/interceptor.h",
"include/perfetto/tracing/internal/basic_types.h",
+ "include/perfetto/tracing/internal/checked_scope.h",
"include/perfetto/tracing/internal/data_source_internal.h",
"include/perfetto/tracing/internal/in_process_tracing_backend.h",
"include/perfetto/tracing/internal/interceptor_trace_writer.h",
@@ -1571,6 +1572,7 @@
"src/tracing/debug_annotation.cc",
"src/tracing/event_context.cc",
"src/tracing/interceptor.cc",
+ "src/tracing/internal/checked_scope.cc",
"src/tracing/internal/interceptor_trace_writer.cc",
"src/tracing/internal/tracing_muxer_fake.cc",
"src/tracing/internal/tracing_muxer_fake.h",