Remove base::Value::CreateNullValue

https://codereview.chromium.org/2792573002
This commit is contained in:
Aleksei Kuzmin 2017-06-17 00:00:41 +03:00
parent c7f2e2731c
commit 3d700ee49f
3 changed files with 13 additions and 10 deletions

View file

@ -14,6 +14,7 @@
#include "atom/browser/web_dialog_helper.h"
#include "atom/common/atom_constants.h"
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
@ -384,7 +385,7 @@ void CommonWebContentsDelegate::DevToolsAddFileSystem(
auto pref_service = GetPrefService(GetDevToolsWebContents());
DictionaryPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
update.Get()->SetWithoutPathExpansion(
path.AsUTF8Unsafe(), base::Value::CreateNullValue());
path.AsUTF8Unsafe(), base::MakeUnique<base::Value>());
web_contents_->CallClientFunction("DevToolsAPI.fileSystemAdded",
file_system_value.get(),

View file

@ -5,6 +5,7 @@
#include "atom/browser/mac/dict_util.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
@ -45,14 +46,14 @@ std::unique_ptr<base::ListValue> NSArrayToListValue(NSArray* arr) {
if (sub_arr)
result->Append(std::move(sub_arr));
else
result->Append(base::Value::CreateNullValue());
result->Append(base::MakeUnique<base::Value>());
} else if ([value isKindOfClass:[NSDictionary class]]) {
std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
if (sub_dict)
result->Append(std::move(sub_dict));
else
result->Append(base::Value::CreateNullValue());
result->Append(base::MakeUnique<base::Value>());
} else {
result->AppendString(base::SysNSStringToUTF8([value description]));
}
@ -104,7 +105,7 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
result->SetWithoutPathExpansion(str_key, std::move(sub_arr));
else
result->SetWithoutPathExpansion(str_key,
base::Value::CreateNullValue());
base::MakeUnique<base::Value>());
} else if ([value isKindOfClass:[NSDictionary class]]) {
std::unique_ptr<base::DictionaryValue> sub_dict =
NSDictionaryToDictionaryValue(value);
@ -112,7 +113,7 @@ std::unique_ptr<base::DictionaryValue> NSDictionaryToDictionaryValue(
result->SetWithoutPathExpansion(str_key, std::move(sub_dict));
else
result->SetWithoutPathExpansion(str_key,
base::Value::CreateNullValue());
base::MakeUnique<base::Value>());
} else {
result->SetStringWithoutPathExpansion(
str_key,

View file

@ -10,6 +10,7 @@
#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "native_mate/dictionary.h"
@ -308,10 +309,10 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
return nullptr;
if (val->IsExternal())
return base::Value::CreateNullValue().release();
return base::MakeUnique<base::Value>().release();
if (val->IsNull())
return base::Value::CreateNullValue().release();
return base::MakeUnique<base::Value>().release();
if (val->IsBoolean())
return new base::Value(val->ToBoolean()->Value());
@ -381,7 +382,7 @@ base::Value* V8ValueConverter::FromV8Array(
v8::Isolate* isolate) const {
ScopedUniquenessGuard uniqueness_guard(state, val);
if (!uniqueness_guard.is_valid())
return base::Value::CreateNullValue().release();
return base::MakeUnique<base::Value>().release();
std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to
@ -410,7 +411,7 @@ base::Value* V8ValueConverter::FromV8Array(
else
// JSON.stringify puts null in places where values don't serialize, for
// example undefined and functions. Emulate that behavior.
result->Append(base::Value::CreateNullValue());
result->Append(base::MakeUnique<base::Value>());
}
return result;
}
@ -429,7 +430,7 @@ base::Value* V8ValueConverter::FromV8Object(
v8::Isolate* isolate) const {
ScopedUniquenessGuard uniqueness_guard(state, val);
if (!uniqueness_guard.is_valid())
return base::Value::CreateNullValue().release();
return base::MakeUnique<base::Value>().release();
std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to