perf: prefer GURL string_view getters (#43443)

* chore: avoid double-call to url.scheme() in WebContentsZoomController::SetZoomMode()

* perf: use gurl.scheme_piece() in GetAppInfoHelperForProtocol()

* perf: use gurl.scheme_piece() in Browser::GetApplicationNameForProtocol()

* refactor: add std::less<> to HandlersMap

This lets us search it using string_view keys

* refactor: ProtocolRegistry::FindRegistered() now takes a std::string_view

* perf: use gurl.scheme_piece() in InspectableWebContents::LoadNetworkResource()

* refactor: ProtocolRegistry::FindIntercepted() now takes a std::string_view

* perf: use gurl.scheme_piece() in SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL()

* perf: use gurl.scheme_piece() in ProxyingURLLoaderFactory::CreateLoaderAndStart()

* perf: use gurl.host_piece() in ElectronWebUIControllerFactory::GetWebUIType()

* perf: use gurl.host_piece() in ElectronWebUIControllerFactory::CreateWebUIControllerForURL()
This commit is contained in:
Charles Kerr 2024-08-23 17:15:45 -05:00 committed by GitHub
parent 7f34b0e6f5
commit 5a1eeea102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 26 additions and 19 deletions

View file

@ -74,7 +74,7 @@ bool ProtocolRegistry::UnregisterProtocol(const std::string& scheme) {
}
const HandlersMap::mapped_type* ProtocolRegistry::FindRegistered(
const std::string& scheme) const {
const std::string_view scheme) const {
const auto& map = handlers_;
const auto iter = map.find(scheme);
return iter != std::end(map) ? &iter->second : nullptr;
@ -91,7 +91,7 @@ bool ProtocolRegistry::UninterceptProtocol(const std::string& scheme) {
}
const HandlersMap::mapped_type* ProtocolRegistry::FindIntercepted(
const std::string& scheme) const {
const std::string_view scheme) const {
const auto& map = intercept_handlers_;
const auto iter = map.find(scheme);
return iter != std::end(map) ? &iter->second : nullptr;