perf: prefer base::SplitStringPiece() over base::SplitString() (#45947)

* perf: use base::SplitStringPiece() in SetNodeOptions()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* perf: use base::SplitStringPiece() in StringToAccelerator()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: StringToAccelerator() now takes a std::string_view

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-03-10 12:24:36 -05:00 committed by GitHub
parent d41ed8a118
commit f90de88c63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 8 deletions

View file

@ -6,7 +6,7 @@
#define ELECTRON_SHELL_BROWSER_UI_ACCELERATOR_UTIL_H_
#include <map>
#include <string>
#include <string_view>
#include "base/memory/raw_ptr.h"
#include "shell/browser/ui/electron_menu_model.h"
@ -21,7 +21,7 @@ typedef struct {
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Parse a string as an accelerator.
bool StringToAccelerator(const std::string& shortcut,
bool StringToAccelerator(std::string_view shortcut,
ui::Accelerator* accelerator);
// Generate a table that contains menu model's accelerators and command ids.