perf: prefer GURL string_view getters (#43471)
* 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
824b1aeb71
commit
f08c6f2e85
10 changed files with 26 additions and 19 deletions
|
@ -186,15 +186,16 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) {
|
|||
|
||||
if (entry) {
|
||||
GURL url = content::HostZoomMap::GetURLFromEntry(entry);
|
||||
std::string host = net::GetHostOrSpecFromURL(url);
|
||||
const std::string host = net::GetHostOrSpecFromURL(url);
|
||||
const std::string scheme = url.scheme();
|
||||
|
||||
if (zoom_map->HasZoomLevel(url.scheme(), host)) {
|
||||
if (zoom_map->HasZoomLevel(scheme, host)) {
|
||||
// If there are other tabs with the same origin, then set this tab's
|
||||
// zoom level to match theirs. The temporary zoom level will be
|
||||
// cleared below, but this call will make sure this tab re-draws at
|
||||
// the correct zoom level.
|
||||
double origin_zoom_level =
|
||||
zoom_map->GetZoomLevelForHostAndScheme(url.scheme(), host);
|
||||
zoom_map->GetZoomLevelForHostAndScheme(scheme, host);
|
||||
event_data_->new_zoom_level = origin_zoom_level;
|
||||
zoom_map->SetTemporaryZoomLevel(rfh_id, origin_zoom_level);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue