perf: prefer GURL string_view getters (#43470)
* chore: avoid double-call to url.scheme() in WebContentsZoomController::SetZoomMode() Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.scheme_piece() in GetAppInfoHelperForProtocol() Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.scheme_piece() in Browser::GetApplicationNameForProtocol() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: add std::less<> to HandlersMap This lets us search it using string_view keys Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: ProtocolRegistry::FindRegistered() now takes a std::string_view Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.scheme_piece() in InspectableWebContents::LoadNetworkResource() Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: ProtocolRegistry::FindIntercepted() now takes a std::string_view Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.scheme_piece() in SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL() Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.scheme_piece() in ProxyingURLLoaderFactory::CreateLoaderAndStart() Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.host_piece() in ElectronWebUIControllerFactory::GetWebUIType() Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: use gurl.host_piece() in ElectronWebUIControllerFactory::CreateWebUIControllerForURL() 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:
parent
5829d2a09a
commit
5a1bab7c3a
10 changed files with 26 additions and 19 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/process/launch.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "electron/electron_version.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
|
@ -124,7 +125,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
|
|||
std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
|
||||
const std::vector<std::string> argv = {
|
||||
"xdg-mime", "query", "default",
|
||||
std::string("x-scheme-handler/") + url.scheme()};
|
||||
base::StrCat({"x-scheme-handler/", url.scheme_piece()})};
|
||||
|
||||
return base::ASCIIToUTF16(GetXdgAppOutput(argv).value_or(std::string()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue