Embed a single sample in histogram metadata.

This uses the new DelayedPersistentAllocation to avoid allocating the
full "counts" array when only one value is being stored.  That one
value is kept in the HistogramSamples metadata.  When a second value
is recorded, the counts-array is created and the single-sample is
moved; it is there-after unused.

This change only affects SampleVector.  A future change may add the
same support for PersistentSampleMap.

A quick test shows persistent memory use is reduced by 44% (from 924
KiB to 512 KiB) after a clean start and the loading of three pages:
  chrome://histograms
  https://www.google.com/
  chrome://histograms  (again)

BUG=705342

Review-Url: https://codereview.chromium.org/2811713003
Cr-Commit-Position: refs/heads/master@{#466401}


CrOS-Libchrome-Original-Commit: 4162bafec82ea11c98d4dc2572337a039b79fdb9
11 files changed
tree: d6b66050d8922d1e1ce2eb45df60408f63c2cde9
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/