Merge "ui: Remove time_in_state metric"
diff --git a/buildtools/BUILD.gn b/buildtools/BUILD.gn
index 2995192..5ef78a2 100644
--- a/buildtools/BUILD.gn
+++ b/buildtools/BUILD.gn
@@ -772,6 +772,8 @@
     "benchmark/src/json_reporter.cc",
     "benchmark/src/log.h",
     "benchmark/src/mutex.h",
+    "benchmark/src/perf_counters.cc",
+    "benchmark/src/perf_counters.h",
     "benchmark/src/re.h",
     "benchmark/src/reporter.cc",
     "benchmark/src/sleep.cc",
diff --git a/src/trace_processor/containers/nullable_vector.h b/src/trace_processor/containers/nullable_vector.h
index 2fed430..537e822 100644
--- a/src/trace_processor/containers/nullable_vector.h
+++ b/src/trace_processor/containers/nullable_vector.h
@@ -152,9 +152,8 @@
       } else {
         valid_.Insert(idx);
 
-        opt_row = valid_.RowOf(idx);
-        PERFETTO_DCHECK(opt_row);
-        data_.insert(data_.begin() + static_cast<ptrdiff_t>(*opt_row), val);
+        uint32_t inserted_row = *valid_.RowOf(idx);
+        data_.insert(data_.begin() + static_cast<ptrdiff_t>(inserted_row), val);
       }
     }
   }
diff --git a/src/traced/probes/ftrace/proto_translation_table_unittest.cc b/src/traced/probes/ftrace/proto_translation_table_unittest.cc
index 2748ac9..a157fad 100644
--- a/src/traced/probes/ftrace/proto_translation_table_unittest.cc
+++ b/src/traced/probes/ftrace/proto_translation_table_unittest.cc
@@ -379,7 +379,7 @@
   std::vector<Event> events;
 
   {
-    Event event;
+    Event event{};
     event.name = "foo";
     event.group = "group_one";
     event.ftrace_event_id = 1;
@@ -387,7 +387,7 @@
   }
 
   {
-    Event event;
+    Event event{};
     event.name = "bar";
     event.group = "group_one";
     event.ftrace_event_id = 2;
@@ -395,7 +395,7 @@
   }
 
   {
-    Event event;
+    Event event{};
     event.name = "baz";
     event.group = "group_two";
     event.ftrace_event_id = 100;
diff --git a/tools/install-build-deps b/tools/install-build-deps
index de21e94..eeb0130 100755
--- a/tools/install-build-deps
+++ b/tools/install-build-deps
@@ -176,7 +176,7 @@
     Dependency(
         'buildtools/benchmark',
         'https://chromium.googlesource.com/external/github.com/google/benchmark.git',
-        '090faecb454fbd6e6e17a75ef8146acb037118d4', 'all', 'all'),
+        'e991355c02b93fe17713efe04cbc2e278e00fdbd', 'all', 'all'),
 
     # Libbacktrace, for stacktraces in Linux/Android debug builds.
     # From https://github.com/ianlancetaylor/libbacktrace/archive/177940370e4a6b2509e92a0aaa9749184e64af43.zip
diff --git a/tools/proto_utils.py b/tools/proto_utils.py
index 45fad89..87a3150 100644
--- a/tools/proto_utils.py
+++ b/tools/proto_utils.py
@@ -18,7 +18,7 @@
 import subprocess
 import tempfile
 
-from google.protobuf import descriptor, descriptor_pb2, message_factory, descriptor_pool
+from google.protobuf import descriptor, descriptor_pb2, message_factory
 from google.protobuf import reflection, text_format
 
 
@@ -26,14 +26,15 @@
 
 
 def create_message_factory(descriptor_file_paths, proto_type):
-  pool = descriptor_pool.DescriptorPool()
+  files = []
   for file_path in descriptor_file_paths:
-    descriptor = read_descriptor(file_path)
-    for file in descriptor.file:
-      pool.Add(file)
+    files.extend(read_descriptor(file_path).file)
 
-  return message_factory.MessageFactory().GetPrototype(
-      pool.FindMessageTypeByName(proto_type))
+  # We use this method rather than working directly with DescriptorPool
+  # because, when the pure-Python protobuf runtime is used, extensions
+  # need to be explicitly registered with the message type. See
+  # https://github.com/protocolbuffers/protobuf/blob/9e09343a49e9e75be576b31ed7402bf8502b080c/python/google/protobuf/message_factory.py#L145
+  return message_factory.GetMessages(files)[proto_type]
 
 
 def read_descriptor(file_name):