Cap the number of pending unserialized profiles

This limits the amount of memory used for unserialized profiles that have
been collected but not yet uploaded (e.g. due to being offline).

When the number of unserialized profiles exceeds the cap, serialize the new
ones to save memory.

Code-wise, this CL changes PendingProfiles to maintain two separate vectors
for unserialized profiles and serialized profiles, so that we can retrieve
the count of each kind of profiles immediately. This CL also simplified the
implementation a bit so that struct ProfileState is no longer needed.

Bug: 888716, 851163
Change-Id: I177d51065da04789db8d411af8387e08336c2342
Reviewed-on: https://chromium-review.googlesource.com/c/1250144
Commit-Queue: Xi Cheng <chengx@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595969}
2 files changed