[Cleanup] Simplify the CallStackProfileMetricsProvider

* Hide more internal logic within PendingProfiles
* Ensure that the functions that collect profiles cannot be called without
  verifying that collection is enabled.
* Move profile serialization out from being under a lock.

There's an important implementation detail: Profiles stored in the two
vectors might end up interleaved, in terms of timestamps. However, it is
still guaranteed that profiles from a single process are ordered consistently
in the uploaded data, which is sufficient for later efficient processing.

BUG=888716,851163
R=chengx@chromium.org

Change-Id: I94c4ab165753e8a09a53490494f8161b197f1428
Reviewed-on: https://chromium-review.googlesource.com/c/1258514
Reviewed-by: Xi Cheng <chengx@chromium.org>
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596997}
1 file changed