[vm] Document lifetime requirements of arguments to Dart_TimelineEvent.

Strengthen requirement on `label` to match Fuchsia.

Change-Id: Iebc9e0cc7be5984ad2b94dde561b76aec64fe78a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96145
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/include/dart_tools_api.h b/runtime/include/dart_tools_api.h
index 402e01d..03b38aa 100644
--- a/runtime/include/dart_tools_api.h
+++ b/runtime/include/dart_tools_api.h
@@ -360,13 +360,17 @@
 /**
  * Add a timeline event to the embedder stream.
  *
- * \param label The name of the evnet.
+ * \param label The name of the event. Its lifetime must extend at least until
+ *     Dart_Cleanup.
  * \param timestamp0 The first timestamp of the event.
  * \param timestamp1_or_async_id The second timestamp of the event or
  *     the async id.
  * \param argument_count The number of argument names and values.
- * \param argument_names An array of names of the arguments.
- * \param argument_values An array of values of the arguments.
+ * \param argument_names An array of names of the arguments. The lifetime of the
+ *     names must extend at least until Dart_Cleanup. The array may be reclaimed
+ *     when this call returns.
+ * \param argument_values An array of values of the arguments. The values and
+ *     the array may be reclaimed when this call returns.
  */
 DART_EXPORT void Dart_TimelineEvent(const char* label,
                                     int64_t timestamp0,
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index b4b0328..38487f6 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5839,7 +5839,6 @@
   if (event == NULL) {
     return;
   }
-  label = strdup(label);
   switch (type) {
     case Dart_Timeline_Event_Begin:
       event->Begin(label, timestamp0);
@@ -5877,7 +5876,6 @@
     default:
       FATAL("Unknown Dart_Timeline_Event_Type");
   }
-  event->set_owns_label(true);
   event->SetNumArguments(argument_count);
   for (intptr_t i = 0; i < argument_count; i++) {
     event->CopyArgument(i, argument_names[i], argument_values[i]);