Remove heap allocation of base::Value from NetLog.
This CL changes NetLogParametersCallback to return a "base::Value" rather than a "std::unique_ptr<base::Value>", and updates the affected callsites.
This is a step towards removing all the deprecated calls in base/values.h. This CL does not change the use of base::DictionaryValue.
Bug: 646113
Bug: 901525
TBR: [email protected],[email protected]
Change-Id: I27465cc27578de22575f4a441f571cdaa3eda4d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1590407
Commit-Queue: Eric Roman <[email protected]>
Reviewed-by: David Benjamin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#655454}
diff --git a/net/log/net_log_source.cc b/net/log/net_log_source.cc
index a427f68..255caf4 100644
--- a/net/log/net_log_source.cc
+++ b/net/log/net_log_source.cc
@@ -17,14 +17,13 @@
namespace {
-std::unique_ptr<base::Value> SourceEventParametersCallback(
+base::Value SourceEventParametersCallback(
const NetLogSource source,
NetLogCaptureMode /* capture_mode */) {
if (!source.IsValid())
- return std::unique_ptr<base::Value>();
- std::unique_ptr<base::DictionaryValue> event_params(
- new base::DictionaryValue());
- source.AddToEventParameters(event_params.get());
+ return base::Value();
+ base::DictionaryValue event_params;
+ source.AddToEventParameters(&event_params);
return std::move(event_params);
}