refactor: replace use of deprecated base::JSONWriter::WriteJson()
(#41215)
* refactor: use base::WriteJson() in ListValueToNSArray() refactor: use base::WriteJson() in DictionaryValueToNSDictionary() * refactor: use base::WriteJson() in Debugger::SendCommand() * refactor: use base::WriteJson() in ScriptingExecuteScriptFunction::Run() * refactor: use base::WriteJson() in HandleAccessibilityRequestCallback()
This commit is contained in:
parent
9bfa16ad7f
commit
2ebaebb603
4 changed files with 13 additions and 16 deletions
|
@ -13,10 +13,10 @@
|
|||
namespace electron {
|
||||
|
||||
NSArray* ListValueToNSArray(const base::Value::List& value) {
|
||||
std::string json;
|
||||
if (!base::JSONWriter::Write(base::ValueView{value}, &json))
|
||||
const auto json = base::WriteJson(value);
|
||||
if (!json.has_value())
|
||||
return nil;
|
||||
NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()];
|
||||
NSData* jsonData = [NSData dataWithBytes:json->data() length:json->size()];
|
||||
id obj = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:0
|
||||
error:nil];
|
||||
|
@ -56,10 +56,10 @@ base::Value::List NSArrayToValue(NSArray* arr) {
|
|||
}
|
||||
|
||||
NSDictionary* DictionaryValueToNSDictionary(const base::Value::Dict& value) {
|
||||
std::string json;
|
||||
if (!base::JSONWriter::Write(base::ValueView{value}, &json))
|
||||
const auto json = base::WriteJson(value);
|
||||
if (!json.has_value())
|
||||
return nil;
|
||||
NSData* jsonData = [NSData dataWithBytes:json.c_str() length:json.length()];
|
||||
NSData* jsonData = [NSData dataWithBytes:json->data() length:json->size()];
|
||||
id obj = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:0
|
||||
error:nil];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue