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

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

Issue 2891933004: Remove raw base::DictionaryValue::Set in //content (Closed)
Patch Set: Rebase 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 3828cf06286b5302a5c9bdf04ce9596477e9beec..97b71dd56ddf2c176f9588c81026de4441784886 100644
--- a/content/browser/media/media_internals.cc
+++ b/content/browser/media/media_internals.cc
@@ -779,7 +779,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);
@@ -871,7 +871,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.
@@ -887,7 +887,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());
@@ -970,7 +970,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