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

Unified Diff: components/login/screens/screen_context.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (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: components/login/screens/screen_context.cc
diff --git a/components/login/screens/screen_context.cc b/components/login/screens/screen_context.cc
index 5e170b682d8f5d7cb067599ad90e56ab76891b6c..b5defbb7d4c8e97ba9c7a60e0f08499436fae282 100644
--- a/components/login/screens/screen_context.cc
+++ b/components/login/screens/screen_context.cc
@@ -5,8 +5,10 @@
#include "components/login/screens/screen_context.h"
#include <memory>
+#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
namespace login {
@@ -176,8 +178,8 @@ bool ScreenContext::Set(const KeyType& key, base::Value* value) {
if (in_storage && new_value->Equals(current_value))
return false;
- changes_.Set(key, new_value->DeepCopy());
- storage_.Set(key, new_value.release());
+ changes_.Set(key, base::MakeUnique<base::Value>(*new_value));
+ storage_.Set(key, std::move(new_value));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698