[webkit-reviews] review granted: [Bug 228108] Protect m_data when iterating in CachedRawResource::didAddClient : [Attachment 433876] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 20 09:12:08 PDT 2021


Chris Dumez <cdumez at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 228108: Protect m_data when iterating in CachedRawResource::didAddClient
https://bugs.webkit.org/show_bug.cgi?id=228108

Attachment 433876: Patch

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




--- Comment #3 from Chris Dumez <cdumez at apple.com> ---
Comment on attachment 433876
  --> https://bugs.webkit.org/attachment.cgi?id=433876
Patch

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

r=me with optional nit fixes.

> Source/WebCore/loader/cache/CachedRawResource.cpp:170
>	       if (m_data) {

We could also just do:
if (auto data = m_data) {

and use data below instead of m_data.

> Source/WebCore/loader/cache/CachedRawResource.cpp:171
> +		   auto protectedData = RefPtr { m_data };

instead of adding the protector here.

> Source/WebCore/loader/cache/CachedRawResource.cpp:173
> +		       if (!hasClient(*client))

Better safe than sorry indeed.

I know we like early return in WebKit, but when it's one line life this, I
don't feel like it's great.


More information about the webkit-reviews mailing list