[webkit-changes] [WebKit/WebKit] 11dcc4: AcceleratedSurfaceDMABuf: Use WeakPtrFactoryInitia...

Alicia Boya García noreply at github.com
Thu Apr 6 04:25:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 11dcc4ddf457c756422ee1c09a37f795d725bcdb
      https://github.com/WebKit/WebKit/commit/11dcc4ddf457c756422ee1c09a37f795d725bcdb
  Author: Alicia Boya Garcia <aboya at igalia.com>
  Date:   2023-04-06 (Thu, 06 Apr 2023)

  Changed paths:
    M Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.h

  Log Message:
  -----------
  AcceleratedSurfaceDMABuf: Use WeakPtrFactoryInitialization::Eager
https://bugs.webkit.org/show_bug.cgi?id=255085

Reviewed by Philippe Normand and Adrian Perez de Castro.

WeakPtrFactory must be initialized with `initializeIfNeeded()` in the
same thread it was constructed. This is guaranteed if you use
WeakPtrFactoryInitialization::Eager, but by default CanMakeWeakPtr uses
WeakPtrFactoryInitialization::Lazy, which defers initialization to the
first time a WeakPtr() is actually created.

That optimization breaks in the case of AcceleratedSurfaceDMABuf as the
WeakPtr are created in the compositor thread but
AcceleratedSurfaceDMABuf was created in the main thread.

This patch fixes the problem by using
WeakPtrFactoryInitialization::Eager as usually required for objects
shared between threads.

* Source/WebKit/WebProcess/WebPage/gtk/AcceleratedSurfaceDMABuf.h:

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




More information about the webkit-changes mailing list