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/profiling_host/profiling_test_driver.h b/chrome/browser/profiling_host/profiling_test_driver.h
index 7a082e2a..8f960b7 100644
--- a/chrome/browser/profiling_host/profiling_test_driver.h
+++ b/chrome/browser/profiling_host/profiling_test_driver.h
@@ -47,9 +47,7 @@
     profiling::mojom::StackMode stack_mode;
 
     // Whether the caller has already started profiling with the given mode.
-    // TODO(erikchen): Implement and test the case where this member is false.
-    // Starting profiling is an asynchronous operation, so this requires adding
-    // some more plumbing. https://crbug.com/753218.
+    // When false, the test driver is responsible for starting profiling.
     bool profiling_already_started;
   };
 
@@ -93,6 +91,7 @@
 
   bool ShouldProfileBrowser();
   bool ShouldProfileRenderer();
+  bool ShouldIncludeNativeThreadNames();
   bool HasPseudoFrames();
 
   void WaitForProfilingToStartForAllRenderersUIThread();