[webkit-changes] [WebKit/WebKit] 9e0be5: ReportingObserver can be kept alive longer than ne...

Ryan Reno noreply at github.com
Thu Jul 11 18:52:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9e0be52714870b41c87cbc959458931757631918
      https://github.com/WebKit/WebKit/commit/9e0be52714870b41c87cbc959458931757631918
  Author: Ryan Reno <rreno at apple.com>
  Date:   2024-07-11 (Thu, 11 Jul 2024)

  Changed paths:
    A LayoutTests/fast/reporting/reporting-observer-lifetime-expected.txt
    A LayoutTests/fast/reporting/reporting-observer-lifetime.html
    M Source/WebCore/Modules/reporting/ReportingObserver.cpp
    M Source/WebCore/Modules/reporting/ReportingObserver.h
    M Source/WebCore/Modules/reporting/ReportingObserver.idl
    M Source/WebCore/Modules/reporting/ReportingScope.cpp
    M Source/WebCore/Modules/reporting/ReportingScope.h

  Log Message:
  -----------
  ReportingObserver can be kept alive longer than necessary.
https://bugs.webkit.org/show_bug.cgi?id=276500
rdar://131559195

Reviewed by Brent Fulgham.

ReportingObserver has the GenerateIsReachable=ImplScriptExecutionContext
extended IDL attribute. This will generate a isReachableFromOpaqueRoots
implementation which will keep the observer alive for as long as the
ScriptExecutionContext exists. However, if we are no longer observing
reports and all JS references to the object are gone, we should allow ourselves
to garbage collect it.

This change turns the ReportingObserver into an ActiveDOMObject whose
pending activity state depends on whether or not it is registered with
the ReportingScope.

* LayoutTests/fast/reporting/reporting-observer-lifetime-expected.txt: Added.
* LayoutTests/fast/reporting/reporting-observer-lifetime.html: Added.
* Source/WebCore/Modules/reporting/ReportingObserver.cpp:
(WebCore::ReportingObserver::create):
(WebCore::ReportingObserver::ReportingObserver):
(WebCore::ReportingObserver::virtualHasPendingActivity const):
* Source/WebCore/Modules/reporting/ReportingObserver.h:
* Source/WebCore/Modules/reporting/ReportingObserver.idl:
* Source/WebCore/Modules/reporting/ReportingScope.cpp:
(WebCore::ReportingScope::containsObserver const):
* Source/WebCore/Modules/reporting/ReportingScope.h:

Canonical link: https://commits.webkit.org/280886@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