[webkit-changes] [WebKit/WebKit] 247ec3: Create a faster cache of _WKWebExtensionTabs

Brian Weinstein noreply at github.com
Tue Mar 5 07:46:58 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 247ec3b89c5405e9dd3c3ef431513b64d38136c0
      https://github.com/WebKit/WebKit/commit/247ec3b89c5405e9dd3c3ef431513b64d38136c0
  Author: Brian Weinstein <bweinstein at apple.com>
  Date:   2024-03-05 (Tue, 05 Mar 2024)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h

  Log Message:
  -----------
  Create a faster cache of _WKWebExtensionTabs
https://bugs.webkit.org/show_bug.cgi?id=270488
rdar://123959934

Reviewed by Timothy Hatcher.

Instead of iterating over all of the tabs in m_tabMap and checking to see if their delegates match, create a new
data structure that is a map table from the delegate to the identifier.

This way, we can just do one O(1) lookup instead of an O(n) iteration.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::WebExtensionContext):
(WebKit::WebExtensionContext::getOrCreateTab const):
(WebKit::WebExtensionContext::forgetTab const):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:

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



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


More information about the webkit-changes mailing list