[webkit-changes] [WebKit/WebKit] dcca26: Regression(270308 at main) WebPageProxy objects are l...

Chris Dumez noreply at github.com
Thu Dec 21 23:07:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dcca261c751d3a4af2154720f3f6cb43f9c47ac1
      https://github.com/WebKit/WebKit/commit/dcca261c751d3a4af2154720f3f6cb43f9c47ac1
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-12-21 (Thu, 21 Dec 2023)

  Changed paths:
    M Source/WebKit/Shared/API/Cocoa/_WKHitTestResult.mm
    M Source/WebKit/UIProcess/API/APIContextMenuElementInfoMac.h
    M Source/WebKit/UIProcess/API/APIHitTestResult.cpp
    M Source/WebKit/UIProcess/API/APIHitTestResult.h
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.mm
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/mac/WKImmediateActionController.mm

  Log Message:
  -----------
  Regression(270308 at main) WebPageProxy objects are leaking
https://bugs.webkit.org/show_bug.cgi?id=266803

Reviewed by Ben Nham.

270308 at main added a couple of data members which hold a strong reference
to the WebPageProxy. This introduced a cycle and we are now leaking
WebPageProxy objects.

The cycle in question is:
WebPageProxy::m_lastMouseMoveHitTestResult <-> API::HitTestResult::m_page

Switch to weak pointers to break the cycle. I don't think hit test results
should keep the page alive anyway.

Thanks to Ben Nham for figuring out which commit caused the memory leak.

* Source/WebKit/Shared/API/Cocoa/_WKHitTestResult.mm:
(-[_WKHitTestResult frameInfo]):
* Source/WebKit/UIProcess/API/APIContextMenuElementInfoMac.h:
* Source/WebKit/UIProcess/API/APIHitTestResult.cpp:
(API::HitTestResult::create):
* Source/WebKit/UIProcess/API/APIHitTestResult.h:
(API::HitTestResult::page):
(API::HitTestResult::HitTestResult):

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




More information about the webkit-changes mailing list