refactor: pass base::Value by value in JS API implementations (#20809)
* refactor: move the arg instead of const reference it * refactor: avoid unnecessary copies of base::Value in arg * refactor: pass-by-value in dict_util * refactor: avoid unnecessary reference
This commit is contained in:
parent
c03ed6d3a1
commit
0ab9cc30d2
26 changed files with 108 additions and 144 deletions
|
@ -665,19 +665,19 @@ gin::Handle<Session> Session::CreateFrom(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
// static
|
||||
gin::Handle<Session> Session::FromPartition(
|
||||
v8::Isolate* isolate,
|
||||
const std::string& partition,
|
||||
const base::DictionaryValue& options) {
|
||||
gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
|
||||
const std::string& partition,
|
||||
base::DictionaryValue options) {
|
||||
scoped_refptr<AtomBrowserContext> browser_context;
|
||||
if (partition.empty()) {
|
||||
browser_context = AtomBrowserContext::From("", false, options);
|
||||
browser_context = AtomBrowserContext::From("", false, std::move(options));
|
||||
} else if (base::StartsWith(partition, kPersistPrefix,
|
||||
base::CompareCase::SENSITIVE)) {
|
||||
std::string name = partition.substr(8);
|
||||
browser_context = AtomBrowserContext::From(name, false, options);
|
||||
browser_context = AtomBrowserContext::From(name, false, std::move(options));
|
||||
} else {
|
||||
browser_context = AtomBrowserContext::From(partition, true, options);
|
||||
browser_context =
|
||||
AtomBrowserContext::From(partition, true, std::move(options));
|
||||
}
|
||||
return CreateFrom(isolate, browser_context.get());
|
||||
}
|
||||
|
@ -743,7 +743,8 @@ v8::Local<v8::Value> FromPartition(const std::string& partition,
|
|||
}
|
||||
base::DictionaryValue options;
|
||||
args->GetNext(&options);
|
||||
return Session::FromPartition(args->isolate(), partition, options).ToV8();
|
||||
return Session::FromPartition(args->isolate(), partition, std::move(options))
|
||||
.ToV8();
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue