[webkit-reviews] review granted: [Bug 224475] [WTF] Add Vector&& move constructor / assignment to FixedVector and RefCountedArray : [Attachment 425848] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Apr 13 02:42:06 PDT 2021
Ryosuke Niwa <rniwa at webkit.org> has granted Yusuke Suzuki <ysuzuki at apple.com>'s
request for review:
Bug 224475: [WTF] Add Vector&& move constructor / assignment to FixedVector and
RefCountedArray
https://bugs.webkit.org/show_bug.cgi?id=224475
Attachment 425848: Patch
https://bugs.webkit.org/attachment.cgi?id=425848&action=review
--- Comment #4 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 425848
--> https://bugs.webkit.org/attachment.cgi?id=425848
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=425848&action=review
>>> Source/WTF/wtf/RefCountedArray.h:131
>>> + new (data + index) T(WTFMove(vector[index]));
>>
>> Why not use VectorTypeOperations so that we can use memcpy when w don't need
to call constructor?
>
> VectorTypeOperations::move is not designed to be used outside of Vector.
> That function relies on that the already-moved buffer will be freed without
destroying entries.
> So, if we use it here, we will see that the same object is destroyed twice
(one in the Vector side, one in this RefCountedArray side).
Ah, ok. I guess it's outside the scope of this patch then
but we should probably come up with a way to use memcpy here.
More information about the webkit-reviews
mailing list