refactor: follow upstream's suggestions on when to use EmptyGURL() (#45521)
- Prefer GURL() when we want to return a non-reference empty URL. - In ServiceWorkerMain::GetStorageKey(), use a reference instead of instantiating a new temporary GURL. From url/gurl.h: > // Returns a reference to a singleton empty GURL. This object is for > // callers who return references but don't have anything to return in > // some cases. If you just want an empty URL for normal use, prefer > // GURL(). 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
8fb9fd97df
commit
5b90ce2290
3 changed files with 4 additions and 4 deletions
|
@ -375,7 +375,7 @@ int WebFrameMain::RoutingID() const {
|
|||
|
||||
GURL WebFrameMain::URL() const {
|
||||
if (!CheckRenderFrame())
|
||||
return GURL::EmptyGURL();
|
||||
return {};
|
||||
return render_frame_->GetLastCommittedURL();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue