Add support for thread names to out of process heap profiling.

This CL adds a new memlog stack mode: native-with-thread-names. When enabled,
the thread name will be inserted as the first frame of each stack.

Other minor changes:
  * Fixed minor bug in the parsing logic for ProfilingTestDriver.
  * Fixed a JSON exporter issue [node and string ids should begin at 1, not 0.
chrome://tracing UI ignores nodes with id 0.]
  * Add TLS destructor for allocator shim.
  * base::android::AttachCurrentThread() now preserves thread name.

Change-Id: I8c9d82084d6439e663f94e563068c987d1cf3b23
Bug: 758739
Reviewed-on: https://chromium-review.googlesource.com/877085
Reviewed-by: Maria Khomenko <[email protected]>
Reviewed-by: Richard Coles <[email protected]>
Reviewed-by: Dmitry Skiba <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Albert J. Wong <[email protected]>
Commit-Queue: Erik Chen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#531992}
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 7fb909f..ea92168 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -532,11 +532,13 @@
 const char kOOPHPStackModeDescription[] =
     "By default, memlog heap dumps record native stacks, which requires a "
     "post-processing step to symbolize. Requires a custom build with frame "
-    "pointers to work on Android. It's also possible to record a pseudo stack "
-    "using trace events as identifiers. It's also possible to do a mix of "
-    "both.";
+    "pointers to work on Android. Native with thread names will add the thread "
+    "name as the first frame of each native stack. It's also possible to "
+    "record a pseudo stack using trace events as identifiers. It's also "
+    "possible to do a mix of both.";
 const char kOOPHPStackModeMixed[] = "Mixed";
 const char kOOPHPStackModeNative[] = "Native";
+const char kOOPHPStackModeNativeWithThreadNames[] = "Native with thread names";
 const char kOOPHPStackModePseudo[] = "Trace events";
 
 const char kEnablePictureInPictureName[] = "Enable picture in picture.";