mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-20 15:09:42 +00:00
Everywhere: Use Optional<T>::ensure() where useful
No functional changes.
This commit is contained in:
parent
0fe9255991
commit
c31eff6a47
Notes:
github-actions[bot]
2025-09-17 16:02:17 +00:00
Author: https://github.com/gmta
Commit: c31eff6a47
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6220
Reviewed-by: https://github.com/rmg-x
Reviewed-by: https://github.com/trflynn89 ✅
14 changed files with 53 additions and 87 deletions
|
@ -21,15 +21,14 @@ bool ListOfAvailableImages::Key::operator==(Key const& other) const
|
|||
|
||||
u32 ListOfAvailableImages::Key::hash() const
|
||||
{
|
||||
if (!cached_hash.has_value()) {
|
||||
return cached_hash.ensure([&] {
|
||||
u32 url_hash = url.hash();
|
||||
u32 mode_hash = static_cast<u32>(mode);
|
||||
u32 origin_hash = 0;
|
||||
if (origin.has_value())
|
||||
origin_hash = Traits<URL::Origin>::hash(origin.value());
|
||||
cached_hash = pair_int_hash(url_hash, pair_int_hash(mode_hash, origin_hash));
|
||||
}
|
||||
return cached_hash.value();
|
||||
return pair_int_hash(url_hash, pair_int_hash(mode_hash, origin_hash));
|
||||
});
|
||||
}
|
||||
|
||||
void ListOfAvailableImages::visit_edges(JS::Cell::Visitor& visitor)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue