Merge "Parse process labels from proto"
diff --git a/src/trace_processor/importers/proto/track_event_parser.cc b/src/trace_processor/importers/proto/track_event_parser.cc
index 5b14db0..2af9a04 100644
--- a/src/trace_processor/importers/proto/track_event_parser.cc
+++ b/src/trace_processor/importers/proto/track_event_parser.cc
@@ -1362,6 +1362,8 @@
           context->storage->InternString("chrome.host_app_package_name")),
       chrome_crash_trace_id_name_id_(
           context->storage->InternString("chrome.crash_trace_id")),
+      chrome_process_label_flat_key_id_(
+          context->storage->InternString("chrome.process_label")),
       chrome_string_lookup_(context->storage.get()),
       counter_unit_ids_{{kNullStringId, context_->storage->InternString("ns"),
                          context_->storage->InternString("count"),
@@ -1463,6 +1465,17 @@
     // Don't override system-provided names.
     context_->process_tracker->SetProcessNameIfUnset(upid, name_id);
   }
+  int label_index = 0;
+  for (auto it = decoder.process_labels(); it; it++) {
+    StringId label_id = context_->storage->InternString(*it);
+    std::string key = "chrome.process_label[";
+    key.append(std::to_string(label_index++));
+    key.append("]");
+    context_->process_tracker->AddArgsTo(upid).AddArg(
+        chrome_process_label_flat_key_id_,
+        context_->storage->InternString(base::StringView(key)),
+        Variadic::String(label_id));
+  }
   return upid;
 }
 
diff --git a/src/trace_processor/importers/proto/track_event_parser.h b/src/trace_processor/importers/proto/track_event_parser.h
index 2b80701..ddf19a4 100644
--- a/src/trace_processor/importers/proto/track_event_parser.h
+++ b/src/trace_processor/importers/proto/track_event_parser.h
@@ -109,6 +109,7 @@
   const StringId chrome_legacy_ipc_line_args_key_id_;
   const StringId chrome_host_app_package_name_id_;
   const StringId chrome_crash_trace_id_name_id_;
+  const StringId chrome_process_label_flat_key_id_;
 
   ChromeStringLookup chrome_string_lookup_;
   std::array<StringId, 4> counter_unit_ids_;