heapprofd: Read whole shmem buffer when stopping data source.

Some users (e.g. `tools/measure_tp_performance.py`), when stopping
tracing, expect to see all allocation/frees that happened before that.

The previous code in UnwindingWorker::OnDisconnect, only called
ReadAndUnwindBatch() once, potentially leaving a lot of unread
alloc/frees in the shared memory buffers.

This commit tries to read all the bytes from the shared memory buffer
that are available when OnDisconnect() is called (if the client somehow
keeps writing, the extra records will be ignored).

In order to avoid blocking the unwinding thread for too long, this
commit splits OnDisconnect in different tasks.

Manual tests:
* tools/measure_tp_performance.py (standalone glibc wrappers) doesn't
  miss data anymore.
* On standalone, if reading all the data takes too long, the data
  source stop timeout kicks in and correctly stops heapprofd.
* On android build, capturing and stopping two concurrent heap
  profiles on different processes works.

Change-Id: Iac3b926f9e54351bf9795035eb811e3538d2c753
diff --git a/CHANGELOG b/CHANGELOG
index 0130294..198ab08 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,9 @@
       synchronous (when starting the trace, rather than on the first batch).
     * Added ksyms_mem_policy = KSYMS_RETAIN_FOREVER config to avoid destroying
       and re-parsing kallsysm repeatedly in benchmark runs.
+    * Improve heap profiling shutdown: now the shared memory buffer where
+      alloc/free records are stored is properly flushed when stopping the data
+      source.
   Trace Processor:
     * Deprecate calling NotifyEndOfFile more than once: Flush should instead be
       used for all but the final call.