Merge "trace_processor: Drop bad frame timeline packets"
diff --git a/debian/rules b/debian/rules
index 82af3a3..a5d6199 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,9 @@
 	  is_hermetic_clang=false is_system_compiler=true is_clang=false\
 	  skip_buildtools_check=true enable_perfetto_integration_tests=false\
 	  enable_perfetto_unittests=false perfetto_use_system_protobuf=true\
-	  perfetto_use_system_zlib=true perfetto_enable_git_rev_version_header=false"
+	  perfetto_use_system_zlib=true perfetto_enable_git_rev_version_header=false\
+	  extra_cflags=\"${CFLAGS}\" extra_cxxflags=\"${CXXFLAGS}\"\
+	  extra_ldflags=\"${CXXFLAGS}\" cc=\"${CC}\" cxx=\"${CXX}\""
 
 override_dh_auto_build:
 	ninja -C out/release perfetto traced traced_probes
diff --git a/include/perfetto/tracing/event_context.h b/include/perfetto/tracing/event_context.h
index 5f9cef6..21cb788 100644
--- a/include/perfetto/tracing/event_context.h
+++ b/include/perfetto/tracing/event_context.h
@@ -69,6 +69,9 @@
   // the reference to this EventContext.
   template <typename MessageType>
   TracedProto<MessageType> Wrap(MessageType* message) {
+    static_assert(std::is_base_of<protozero::Message, MessageType>::value,
+                  "TracedProto can be used only with protozero messages");
+
     return TracedProto<MessageType>(message, *this);
   }
 
diff --git a/include/perfetto/tracing/traced_proto.h b/include/perfetto/tracing/traced_proto.h
index 0b836b4..44e4fb2 100644
--- a/include/perfetto/tracing/traced_proto.h
+++ b/include/perfetto/tracing/traced_proto.h
@@ -49,9 +49,6 @@
 template <typename MessageType>
 class TracedProto {
  public:
-  static_assert(std::is_base_of<protozero::Message, MessageType>::value,
-                "TracedProto can be used only with protozero messages");
-
   TracedProto(const TracedProto&) = delete;
   TracedProto& operator=(const TracedProto&) = delete;
   TracedProto& operator=(TracedProto&&) = delete;
diff --git a/protos/third_party/chromium/chrome_track_event.proto b/protos/third_party/chromium/chrome_track_event.proto
index 5a8939e..813b174 100644
--- a/protos/third_party/chromium/chrome_track_event.proto
+++ b/protos/third_party/chromium/chrome_track_event.proto
@@ -50,7 +50,7 @@
   optional uint64 source_location_iid = 4;
 }
 
-message ChromeTaskGraphRunner {
+message ChromeRasterTask {
   optional int64 source_frame_number = 1;
 }
 
@@ -125,9 +125,16 @@
   optional bool has_speculative_render_frame_host = 3;
 }
 
+message ChromeHashedPerformanceMark {
+  optional uint32 site_hash = 1;
+  optional string site = 2;
+  optional uint32 mark_hash = 3;
+  optional string mark = 4;
+}
+
 message ChromeTrackEvent {
   // Extension range for Chrome: 1000-1999
-  // Next ID: 1011
+  // Next ID: 1012
   extend TrackEvent {
     optional ChromeAppState chrome_app_state = 1000;
 
@@ -143,7 +150,7 @@
     optional ChromeTaskPostedToDisabledQueue
         chrome_task_posted_to_disabled_queue = 1005;
 
-    optional ChromeTaskGraphRunner chrome_task_graph_runner = 1006;
+    optional ChromeRasterTask chrome_raster_task = 1006;
 
     optional ChromeMessagePumpForUI chrome_message_pump_for_ui = 1007;
 
@@ -153,5 +160,7 @@
         should_swap_browsing_instances_result = 1009;
 
     optional FrameTreeNodeInfo frame_tree_node_info = 1010;
+
+    optional ChromeHashedPerformanceMark chrome_hashed_performance_mark = 1011;
   }
 }
diff --git a/src/trace_processor/metrics/android/android_startup.sql b/src/trace_processor/metrics/android/android_startup.sql
index 802ee7c..6ea79ee 100644
--- a/src/trace_processor/metrics/android/android_startup.sql
+++ b/src/trace_processor/metrics/android/android_startup.sql
@@ -225,9 +225,14 @@
     OR slice_name LIKE '%concurrent copying GC'
     OR slice_name LIKE '%semispace GC');
 
+DROP TABLE IF EXISTS gc_slices_by_state;
 CREATE VIRTUAL TABLE gc_slices_by_state
 USING SPAN_JOIN(gc_slices PARTITIONED utid, thread_state_extended PARTITIONED utid);
 
+DROP TABLE IF EXISTS launch_threads_cpu;
+CREATE VIRTUAL TABLE launch_threads_cpu
+USING SPAN_JOIN(launch_threads PARTITIONED utid, thread_state_extended PARTITIONED utid);
+
 DROP VIEW IF EXISTS startup_view;
 CREATE VIEW startup_view AS
 SELECT
@@ -425,15 +430,13 @@
       'time_jit_thread_pool_on_cpu', (
         SELECT
         NULL_IF_EMPTY(AndroidStartupMetric_Slice(
-          'dur_ns', SUM(states.dur),
-          'dur_ms', SUM(states.dur) / 1e6))
-        FROM launch_threads
-        JOIN thread_state_extended states USING(utid)
+          'dur_ns', SUM(dur),
+          'dur_ms', SUM(dur) / 1e6))
+        FROM launch_threads_cpu
         WHERE
-          launch_threads.launch_id = launches.id
-          AND launch_threads.thread_name = 'Jit thread pool'
-          AND states.state = 'Running'
-          AND states.ts BETWEEN launch_threads.ts AND launch_threads.ts + launch_threads.dur
+          launch_id = launches.id
+          AND thread_name = 'Jit thread pool'
+          AND state = 'Running'
       ),
       'time_gc_total', (
         SELECT slice_proto