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:
parent
7f34b0e6f5
commit
5a1eeea102
10 changed files with 26 additions and 19 deletions
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_PROTOCOL_REGISTRY_H_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "shell/browser/net/electron_url_loader_factory.h"
|
||||
|
@ -40,7 +41,7 @@ class ProtocolRegistry {
|
|||
bool UnregisterProtocol(const std::string& scheme);
|
||||
|
||||
[[nodiscard]] const HandlersMap::mapped_type* FindRegistered(
|
||||
const std::string& scheme) const;
|
||||
std::string_view scheme) const;
|
||||
|
||||
bool InterceptProtocol(ProtocolType type,
|
||||
const std::string& scheme,
|
||||
|
@ -48,7 +49,7 @@ class ProtocolRegistry {
|
|||
bool UninterceptProtocol(const std::string& scheme);
|
||||
|
||||
[[nodiscard]] const HandlersMap::mapped_type* FindIntercepted(
|
||||
const std::string& scheme) const;
|
||||
std::string_view scheme) const;
|
||||
|
||||
private:
|
||||
friend class ElectronBrowserContext;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue