perf: avoid protocol registry redundant lookup (#41991)

* perf: avoid redundant map lookup in SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL()

* perf: avoid redundant map lookup in InspectableWebContents::LoadNetworkResource()

* refactor: remove unused ProtocolRegistry::IsProtocolRegistered()

refactor: remove unused ProtocolRegistry::IsProtocolIntercepted()

* refactor: remove unused ProtocolRegistry::handlers()

* refactor: rename ProtocolRegistry::FindIntercepted()

refactor: rename ProtocolRegistry::FindRegistered()

similar semantics to base::Value::Find*()

* chore: follow Google C++ brace style

chore: use same variable names as in main
This commit is contained in:
Charles Kerr 2024-05-09 08:53:09 -05:00 committed by GitHub
parent 865b0499bb
commit e2acdffe58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 54 additions and 52 deletions

View file

@ -33,19 +33,22 @@ class ProtocolRegistry {
CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme);
const HandlersMap& intercept_handlers() const { return intercept_handlers_; }
const HandlersMap& handlers() const { return handlers_; }
bool RegisterProtocol(ProtocolType type,
const std::string& scheme,
const ProtocolHandler& handler);
bool UnregisterProtocol(const std::string& scheme);
bool IsProtocolRegistered(const std::string& scheme);
[[nodiscard]] const HandlersMap::mapped_type* FindRegistered(
const std::string& scheme) const;
bool InterceptProtocol(ProtocolType type,
const std::string& scheme,
const ProtocolHandler& handler);
bool UninterceptProtocol(const std::string& scheme);
bool IsProtocolIntercepted(const std::string& scheme);
[[nodiscard]] const HandlersMap::mapped_type* FindIntercepted(
const std::string& scheme) const;
private:
friend class ElectronBrowserContext;