Migrates base/metrics to v2 of base::Value

Migrates base::Value usage in base/metrics to v2 of base::Value.

Bug: 1303949
Change-Id: Ifc02ca2bd31f7ba599e9b6b9f0300350d0ba1ef0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758897
Reviewed-by: Mike Dougherty <[email protected]>
Reviewed-by: Maggie Chen <[email protected]>
Reviewed-by: Weilun Shi <[email protected]>
Commit-Queue: Nathan Memmott <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1024966}
diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc
index 9c90d893..1056c163 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -84,8 +84,7 @@
     const char* name,
     HistogramSamples::Metadata* meta,
     HistogramSamples::Metadata* logged_meta) {
-  return WrapUnique(
-      new SparseHistogram(allocator, name, meta, logged_meta));
+  return WrapUnique(new SparseHistogram(allocator, name, meta, logged_meta));
 }
 
 SparseHistogram::~SparseHistogram() = default;
@@ -166,7 +165,7 @@
   return unlogged_samples_->AddFromPickle(iter);
 }
 
-base::Value SparseHistogram::ToGraphDict() const {
+base::Value::Dict SparseHistogram::ToGraphDict() const {
   std::unique_ptr<HistogramSamples> snapshot = SnapshotSamples();
   return snapshot->ToGraphDict(histogram_name(), flags());
 }
@@ -215,11 +214,11 @@
   return SparseHistogram::FactoryGet(histogram_name, flags);
 }
 
-Value SparseHistogram::GetParameters() const {
+Value::Dict SparseHistogram::GetParameters() const {
   // Unlike Histogram::GetParameters, only set the type here, and no other
   // params. The other params do not make sense for sparse histograms.
-  Value params(Value::Type::DICTIONARY);
-  params.SetStringKey("type", HistogramTypeToString(GetHistogramType()));
+  Value::Dict params;
+  params.Set("type", HistogramTypeToString(GetHistogramType()));
   return params;
 }