[webkit-reviews] review granted: [Bug 200925] WebSQLiteDatabaseTracker does not ensure it is still alive after dispatching to the main thread : [Attachment 376781] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 20 10:48:16 PDT 2019


Geoffrey Garen <ggaren at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 200925: WebSQLiteDatabaseTracker does not ensure it is still alive after
dispatching to the main thread
https://bugs.webkit.org/show_bug.cgi?id=200925

Attachment 376781: Patch

https://bugs.webkit.org/attachment.cgi?id=376781&action=review




--- Comment #2 from Geoffrey Garen <ggaren at apple.com> ---
Comment on attachment 376781
  --> https://bugs.webkit.org/attachment.cgi?id=376781
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=376781&action=review

r=me

> Source/WebKit/Shared/WebSQLiteDatabaseTracker.cpp:39
> +    : m_weakThis(makeWeakPtr(*this))

This data member is just a copy of the pointer held by
CanMakeWeakPtr<WebSQLiteDatabaseTracker>. It would be slightly more efficient
to remove this data member, and instead do [weakThis = makeWeakPtr(*this)] in
our lambda capture expressions.

If there's an issue where it's not safe to call makeWeakPtr(*this) in our
lambda capture expressions because they execute on another thread, then I'd
recommend just calling makeWeakPtr(*this) here but not storing the result, with
a comment explaining that we want to avoid initializing our weak pointer on a
secondary thread.


More information about the webkit-reviews mailing list