refactor: avoid a few unnecessary strings (#47644)

* perf: replace string temporary with string_view in GetXdgAppId()

* perf: replace string temporary with string_view in ToV8(WindowOpenDisposition)

* perf: replace string temporary with string_view in ToV8(electron::api::WebContents::Type)
This commit is contained in:
Charles Kerr 2025-07-03 11:08:59 -05:00 committed by GitHub
commit bc585b6a3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -242,7 +242,7 @@ template <>
struct Converter<WindowOpenDisposition> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
WindowOpenDisposition val) {
std::string disposition = "other";
std::string_view disposition = "other";
switch (val) {
case WindowOpenDisposition::CURRENT_TAB:
disposition = "default";
@ -303,7 +303,7 @@ struct Converter<electron::api::WebContents::Type> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
electron::api::WebContents::Type val) {
using Type = electron::api::WebContents::Type;
std::string type;
std::string_view type;
switch (val) {
case Type::kBackgroundPage:
type = "backgroundPage";