Remove legacy Dict and List storage

Bug: 646113
Change-Id: Iaaee9ca0152fb2b2d3dc6fe8fcea6ab42df941e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4210430
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Daniel Cheng <[email protected]>
Auto-Submit: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1099483}
diff --git a/base/values.h b/base/values.h
index 751af52..b30ad89 100644
--- a/base/values.h
+++ b/base/values.h
@@ -181,12 +181,6 @@
  public:
   using BlobStorage = std::vector<uint8_t>;
 
-  // Like `DictStorage`, but with std::unique_ptr in the mapped type. This is
-  // due to legacy reasons, and should be replaced with
-  // flat_map<std::string, Value> once no caller relies on stability of pointers
-  // anymore.
-  using LegacyDictStorage = flat_map<std::string, std::unique_ptr<Value>>;
-
   class Dict;
   class List;
 
@@ -509,6 +503,11 @@
 
     absl::optional<Value> ExtractByDottedPath(StringPiece path);
 
+    // Estimates dynamic memory usage. Requires tracing support
+    // (enable_base_tracing gn flag), otherwise always returns 0. See
+    // base/trace_event/memory_usage_estimator.h for more info.
+    size_t EstimateMemoryUsage() const;
+
     // Serializes to a string for logging and debug purposes.
     std::string DebugString() const;
 
@@ -525,11 +524,14 @@
     BASE_EXPORT friend bool operator<=(const Dict& lhs, const Dict& rhs);
     BASE_EXPORT friend bool operator>=(const Dict& lhs, const Dict& rhs);
 
-    // For legacy access to the internal storage type.
+    // For legacy access to the internal storage type. DEPRECATED; remove when
+    // no longer used.
     friend Value;
 
     explicit Dict(const flat_map<std::string, std::unique_ptr<Value>>& storage);
 
+    // TODO(dcheng): Replace with `flat_map<std::string, Value>` once no caller
+    // relies on stability of pointers anymore.
     flat_map<std::string, std::unique_ptr<Value>> storage_;
   };
 
@@ -661,7 +663,8 @@
     BASE_EXPORT friend bool operator<=(const List& lhs, const List& rhs);
     BASE_EXPORT friend bool operator>=(const List& lhs, const List& rhs);
 
-    // For legacy access to the internal storage type.
+    // For legacy access to the internal storage type. DEPRECATED; remove when
+    // no longer used.
     friend Value;
 
     explicit List(const std::vector<Value>& storage);
@@ -1058,11 +1061,6 @@
     return absl::visit(std::forward<Visitor>(visitor), data_);
   }
 
- protected:
-  // Checked convenience accessors for dict and list.
-  const LegacyDictStorage& dict() const { return GetDict().storage_; }
-  LegacyDictStorage& dict() { return GetDict().storage_; }
-
  private:
   // For access to DoubleStorage.
   friend class ValueView;