[webkit-reviews] review granted: [Bug 213698] RTCDataChannel.bufferedAmount should stay the same even if channel is closed : [Attachment 403000] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 28 13:14:31 PDT 2020


Darin Adler <darin at apple.com> has granted youenn fablet <youennf at gmail.com>'s
request for review:
Bug 213698: RTCDataChannel.bufferedAmount should stay the same even if channel
is closed
https://bugs.webkit.org/show_bug.cgi?id=213698

Attachment 403000: Patch

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




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 403000
  --> https://bugs.webkit.org/attachment.cgi?id=403000
Patch

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

> Source/WebCore/Modules/mediastream/RTCDataChannel.cpp:124
> +    m_bufferedAmount += data.utf8().length();

This is an unnecessarily costly operation. It allocates memory for a UTF-8
string just to check its length and then deallocate the memory. If we need to
do this, we could make an efficient function that computes this length without
allocating and deallocating memory. Another option would be to carry this
around already encoded as UTF-8 rather than converting from a String to UTF-8
twice. I think that would mean putting a CString into the message queue? Or
maybe the String can be UTF-8 encoded into some other class that the code knows
how to handle already?


More information about the webkit-reviews mailing list