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

Unified Diff: base/value_conversions.cc

Issue 2773513002: Stop passing raw pointers to DictionaryValue::Set, part 1 (Closed)
Patch Set: Fix compilation Created 3 years, 9 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
« no previous file with comments | « base/value_conversions.h ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/value_conversions.cc
diff --git a/base/value_conversions.cc b/base/value_conversions.cc
index 9320feecc67293d7ef31ac0ca312d891dc0d3f0b..7f220004e14b27d9165564f2719c37f432fe5b07 100644
--- a/base/value_conversions.cc
+++ b/base/value_conversions.cc
@@ -9,6 +9,7 @@
#include <string>
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -17,8 +18,8 @@ namespace base {
// |Value| internally stores strings in UTF-8, so we have to convert from the
// system native code to UTF-8 and back.
-Value* CreateFilePathValue(const FilePath& in_value) {
- return new Value(in_value.AsUTF8Unsafe());
+std::unique_ptr<Value> CreateFilePathValue(const FilePath& in_value) {
+ return base::MakeUnique<Value>(in_value.AsUTF8Unsafe());
}
bool GetValueAsFilePath(const Value& value, FilePath* file_path) {
@@ -32,9 +33,9 @@ bool GetValueAsFilePath(const Value& value, FilePath* file_path) {
// |Value| does not support 64-bit integers, and doubles do not have enough
// precision, so we store the 64-bit time value as a string instead.
-Value* CreateTimeDeltaValue(const TimeDelta& time) {
+std::unique_ptr<Value> CreateTimeDeltaValue(const TimeDelta& time) {
std::string string_value = base::Int64ToString(time.ToInternalValue());
- return new Value(string_value);
+ return base::MakeUnique<Value>(string_value);
}
bool GetValueAsTimeDelta(const Value& value, TimeDelta* time) {
« no previous file with comments | « base/value_conversions.h ('k') | cc/layers/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698