Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: content/browser/media/media_internals.cc

Issue 2891933004: Remove raw base::DictionaryValue::Set in //content (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/media/media_internals.cc
diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc
index a8086ef5b37eff998a3dd3047d4adc07a7b218a0..bd538e3df58d2afd075795877060fe2b512a7266 100644
--- a/content/browser/media/media_internals.cc
+++ b/content/browser/media/media_internals.cc
@@ -666,7 +666,7 @@ static bool ConvertEventToUpdate(int render_process_id,
dict.SetString("params.pipeline_error",
media::MediaLog::PipelineStatusToString(error));
} else {
- dict.Set("params", event.params.DeepCopy());
+ dict.Set("params", base::MakeUnique<base::Value>(event.params));
}
*update = SerializeUpdate("media.onMediaEvent", &dict);
@@ -758,7 +758,7 @@ void MediaInternals::UpdateVideoCaptureDeviceCapabilities(
video_capture_capabilities_cached_data_.Clear();
for (const auto& device_format_pair : descriptors_and_formats) {
- base::ListValue* format_list = new base::ListValue();
+ auto format_list = base::MakeUnique<base::ListValue>();
// TODO(nisse): Representing format information as a string, to be
// parsed by the javascript handler, is brittle. Consider passing
// a list of mappings instead.
@@ -774,7 +774,7 @@ void MediaInternals::UpdateVideoCaptureDeviceCapabilities(
new base::DictionaryValue());
device_dict->SetString("id", descriptor.device_id);
device_dict->SetString("name", descriptor.GetNameAndModel());
- device_dict->Set("formats", format_list);
+ device_dict->Set("formats", std::move(format_list));
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
defined(OS_ANDROID)
device_dict->SetString("captureApi", descriptor.GetCaptureApiTypeString());
@@ -857,7 +857,8 @@ void MediaInternals::UpdateAudioLog(AudioLogUpdateType type,
return;
} else if (!has_entry) {
DCHECK_EQ(type, CREATE);
- audio_streams_cached_data_.Set(cache_key, value->DeepCopy());
+ audio_streams_cached_data_.Set(cache_key,
+ base::MakeUnique<base::Value>(*value));
} else if (type == UPDATE_AND_DELETE) {
std::unique_ptr<base::Value> out_value;
CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value));
« no previous file with comments | « content/browser/indexed_db/indexed_db_context_impl.cc ('k') | content/browser/media/media_internals_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698