TraceProcessor: add support for complete JSON events

Will require some follow-up clean ups, but in the meanwhile
brings us into a nice state w.r.t. digesting legacy traces.

This CL:
- Extracts thread and process names from metadata events.
- Creates a full stack of slice using both duration and complete events
  (TRACE_EVENT_BEGIN/END(...) and TRACE_EVENT(...))
- Exposes pids and tid in the process and thread vtables.
- Refactors the ProcessTracker to support identifying threads.
  by the pid+tid tuple.
- Improves the hashing of the string pool using 32-bit FNV-1a.

See https://ghostbin.com/paste/bpvq7 for a sample SQL query.

Change-Id: I567b102e14770e521f60650bcab45cb0f24fb76c
diff --git a/src/trace_processor/trace_storage.cc b/src/trace_processor/trace_storage.cc
index e6d0f55..38cb414 100644
--- a/src/trace_processor/trace_storage.cc
+++ b/src/trace_processor/trace_storage.cc
@@ -23,8 +23,11 @@
 
 TraceStorage::TraceStorage() {
   // Upid/utid 0 is reserved for invalid processes/threads.
-  unique_processes_.emplace_back();
-  unique_threads_.emplace_back();
+  unique_processes_.emplace_back(0);
+  unique_threads_.emplace_back(0);
+
+  // Reserve string ID 0 for the empty string.
+  InternString("", 0);
 }
 
 TraceStorage::~TraceStorage() {}
@@ -37,9 +40,10 @@
 };
 
 StringId TraceStorage::InternString(const char* data, size_t length) {
-  uint32_t hash = 0;
+  uint32_t hash = 0x811c9dc5;  // FNV-1a-32 offset basis.
   for (size_t i = 0; i < length; ++i) {
-    hash = static_cast<uint32_t>(data[i]) + (hash * 31);
+    hash ^= static_cast<decltype(hash)>(data[i]);
+    hash *= 16777619;  // FNV-1a-32 prime.
   }
   auto id_it = string_index_.find(hash);
   if (id_it != string_index_.end()) {