Refactor histogram_persistence to be a class.

The number of top-level functions was getting too large
and impeding development of other features due to the
previous lack of OO design.

The code is largely unchanged, just moved into a stateful
class and reordered to match the public/private sections
of the class.

Two other CLs are included here because they fit well with the refactoring:

https://codereview.chromium.org/1689833002/
Add ownership-transfer to histogram management calls.

  This CL changes the interface to use scoped_ptr to
  explicitly document, with std::move, when the transfer
  of ownership is taking place.

https://codereview.chromium.org/1731453002/
Reduce histogram creation time by avoiding import of those just created.

  Attempting to import histograms in the persistent memory
  segment is necessary because it could be shared and thus
  have other processes creating objects within it. However,
  there's no need to import those objects that this process
  created.

  The simple method remembering the "reference" of the last
  histogram created in the allocator catches almost all
  cases and reduces histogram creation time by 40%.

BUG=546019
TBR=grt,thakis
grt: setup/installer_metrics.cc (no logic changes)
thakis: gn & gyp changes for new files

Review URL: https://codereview.chromium.org/1738063002

Cr-Commit-Position: refs/heads/master@{#381386}
18 files changed