Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e0c66a032d8428e0e2165e6db21e0ac6fceb65d9
      
https://github.com/WebKit/WebKit/commit/e0c66a032d8428e0e2165e6db21e0ac6fceb65d9
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M Source/WebCore/Modules/geolocation/Geolocation.cpp
    M Source/WebCore/Modules/geolocation/Geolocation.h

  Log Message:
  -----------
  Geolocation::Watchers should not maintain a redundant reverse notifier→id map
https://bugs.webkit.org/show_bug.cgi?id=323589
rdar://186827644

Reviewed by Chris Dumez.

Geolocation::Watchers kept two maps in sync by hand: an
OrderedHashMap<int, Ref<GeoNotifier>> for id→notifier lookup and a
HashMap<Ref<GeoNotifier>, int> whose only purpose was the reverse
notifier→id lookup used by remove(GeoNotifier*) and contains(GeoNotifier*).

The reverse map is unnecessary. The number of watchers on a document is
tiny (typically zero to a few), so the two by-notifier operations can
iterate the forward map instead of paying for a second hash map and the
manual bookkeeping to keep it consistent on every add/remove/clear.

Remove m_notifierToIdMap. remove(GeoNotifier*) now uses
OrderedHashMap::removeIf() and contains(GeoNotifier*) iterates values().

No behavior change.

* Source/WebCore/Modules/geolocation/Geolocation.cpp:
(WebCore::Geolocation::Watchers::add):
(WebCore::Geolocation::Watchers::remove):
(WebCore::Geolocation::Watchers::contains const):
(WebCore::Geolocation::Watchers::clear):
* Source/WebCore/Modules/geolocation/Geolocation.h:

Canonical link: https://commits.webkit.org/321026@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to