mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
perf: remove unnecessary .c_str() calls (#41869)
* perf: remove unnecessary c_str() call when invoking promise.RejectWithErrorMessage()
RejectWithErrorMessage() takes a std::string_view
* perf: remove unnecessary c_str() call when invoking Environment::SetVar()
the val arg to Environment::SetVar() takes a const std::string&
* refactor: use string_view variant of base::UTF8ToWide()
* perf: remove unnecessary c_str() call when instantiating a ScopedHString
ScopedHString has always taken a StringPiece
* refactor: use simpler invocation of base::make_span()
* perf: remove unnecessary c_str() call when calling base::CommandLine::HasSwitch()
HasSwitch() already takes a string_piece
* perf: remove unnecessary c_str() call when calling net::HttpResponseHeaders::AddHeader()
AddHeader() already takes a StringPiece arg
* perf: omit unnecessary str -> wstr -> str conversion in DesktopCapturer::UpdateSourcesList()
this conversion was made redundant by c670e38
This commit is contained in:
@@ -14,12 +14,11 @@
|
||||
namespace {
|
||||
|
||||
bool HasSwitch(const std::string& name) {
|
||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(name.c_str());
|
||||
return base::CommandLine::ForCurrentProcess()->HasSwitch(name);
|
||||
}
|
||||
|
||||
base::CommandLine::StringType GetSwitchValue(const std::string& name) {
|
||||
return base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
|
||||
name.c_str());
|
||||
return base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(name);
|
||||
}
|
||||
|
||||
void AppendSwitch(const std::string& switch_string,
|
||||
|
||||
@@ -51,7 +51,7 @@ void OnOpenFinished(gin_helper::Promise<void> promise,
|
||||
if (error.empty())
|
||||
promise.Resolve();
|
||||
else
|
||||
promise.RejectWithErrorMessage(error.c_str());
|
||||
promise.RejectWithErrorMessage(error);
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> OpenExternal(const GURL& url, gin::Arguments* args) {
|
||||
|
||||
Reference in New Issue
Block a user