OOP HP: Unify code for testing and heap dump upload.

Previously, there was two sets of mostly identical logic to start a trace,
ensure that heap dumps are collected, and then report the results.

Bug: 753218
Change-Id: I8dba3c94256a8da9e9364b49bd86275db14a9df3
Reviewed-on: https://chromium-review.googlesource.com/777554
Commit-Queue: Erik Chen <[email protected]>
Reviewed-by: Brett Wilson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#519927}
diff --git a/chrome/browser/profiling_host/profiling_test_driver.h b/chrome/browser/profiling_host/profiling_test_driver.h
index 3820e2a..6aaa8ed 100644
--- a/chrome/browser/profiling_host/profiling_test_driver.h
+++ b/chrome/browser/profiling_host/profiling_test_driver.h
@@ -84,6 +84,10 @@
   // signal |wait_for_ui_thread_|.
   void CollectResults(bool synchronous);
 
+  void TraceFinished(base::Closure closure,
+                     bool success,
+                     std::string trace_json);
+
   bool ValidateBrowserAllocations(base::Value* dump_json);
   bool ValidateRendererAllocations(base::Value* dump_json);
 
@@ -100,7 +104,7 @@
   base::PartitionAllocatorGeneric partition_allocator_;
 
   // Contains nothing until |CollectResults| has been called.
-  scoped_refptr<base::RefCountedString> serialized_trace_;
+  std::string serialized_trace_;
 
   // Whether the test was invoked on the ui thread.
   bool running_on_ui_thread_ = true;