Merge "Optimise read time_in_state"
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/include/perfetto/tracing/track.h b/include/perfetto/tracing/track.h
index 8a4df74..f297b08 100644
--- a/include/perfetto/tracing/track.h
+++ b/include/perfetto/tracing/track.h
@@ -91,8 +91,11 @@
   static Track Global(uint64_t id) { return Track(id, Track()); }
 
  protected:
-  static Track MakeThreadTrack(base::PlatformThreadId tid_) {
-    return Track(static_cast<uint64_t>(tid_), MakeProcessTrack());
+  static Track MakeThreadTrack(base::PlatformThreadId tid) {
+    // If tid were 0 here (which is an invalid tid), we would create a thread
+    // track with a uuid that conflicts with the corresponding ProcessTrack.
+    PERFETTO_DCHECK(tid != 0);
+    return Track(static_cast<uint64_t>(tid), MakeProcessTrack());
   }
 
   static Track MakeProcessTrack() { return Track(process_uuid, Track()); }