mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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:
@@ -53,8 +53,8 @@ using ProtocolHandler =
|
||||
StartLoadingCallback)>;
|
||||
|
||||
// scheme => (type, handler).
|
||||
using HandlersMap =
|
||||
std::map<std::string, std::pair<ProtocolType, ProtocolHandler>>;
|
||||
using HandlersMap = std::
|
||||
map<std::string, std::pair<ProtocolType, ProtocolHandler>, std::less<>>;
|
||||
|
||||
// Implementation of URLLoaderFactory.
|
||||
class ElectronURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
||||
|
||||
@@ -806,7 +806,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart(
|
||||
bool bypass_custom_protocol_handlers =
|
||||
options & kBypassCustomProtocolHandlers;
|
||||
if (!bypass_custom_protocol_handlers) {
|
||||
auto it = intercepted_handlers_->find(request.url.scheme());
|
||||
auto it = intercepted_handlers_->find(request.url.scheme_piece());
|
||||
if (it != intercepted_handlers_->end()) {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> loader_remote;
|
||||
this->Clone(loader_remote.InitWithNewPipeAndPassReceiver());
|
||||
|
||||
Reference in New Issue
Block a user