Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0405c02b6c3eed1cb46e79fee8ac50fced5296d1
      
https://github.com/WebKit/WebKit/commit/0405c02b6c3eed1cb46e79fee8ac50fced5296d1
  Author: Nikolas Zimmermann <nzimmerm...@igalia.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/controls/ControlPart.cpp
    M Source/WebCore/platform/graphics/controls/ControlPart.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp

  Log Message:
  -----------
  [GTK][WPE] Clicking 'Run Benchmark' button on MotionMark 1.3(.1) 
developer.html asserts with threaded CPU rendering
https://bugs.webkit.org/show_bug.cgi?id=280629

Reviewed by Said Abou-Hallawa.

If a DisplayList is recorded in the Gtk/WPE ports, a ControlFactory is
created on the main thread (ControlFactory::shared()) that is used for
drawing control parts (such as a ToggleButtonPart).

In the threaded CPU rendering mode, we replay such a DisplayList in a
secondary thread. However, we cannot use the same ControlFactory, but
need to allocate a per-thread ControlFactory, since the
ControlFactory::shared() is MainThreadNeverDestroyed, and thus only
allows accesses from the main thread.

The ControlFactory we pass to the display list replaying mechanism, is
then stored in RefPtr<ControlFactory> in ControlPart -- in our case a
ControlFactory from the secondary thread is now stored in ControlPart.
Upon render tree destruction (tearDownRenderers()) we end up trying to
deref() a worker-thread owned ControlFactory, from the main thread,
which fires an assertion, since ControlFactory is not thread-safe.

Fix that, by only overriding the ControlFactory temporarily, when
handling a DrawControlPart display list item, and immediately reset it
again after usage, to avoid that situation.

Covered by existing tests.

* Source/WebCore/platform/graphics/controls/ControlPart.cpp:
(WebCore::ControlPart::controlFactory const):
* Source/WebCore/platform/graphics/controls/ControlPart.h:
(WebCore::ControlPart::setOverrideControlFactory):
(WebCore::ControlPart::setControlFactory): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawControlPart::apply const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to