WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
67477
WebSocket: Send ArrayBuffer as WebSocket binary message
https://bugs.webkit.org/show_bug.cgi?id=67477
Summary
WebSocket: Send ArrayBuffer as WebSocket binary message
Yuta Kitamura
Reported
2011-09-02 05:05:32 PDT
The last part of
bug 65249
, sibling of
bug 67465
.
Attachments
Patch
(37.14 KB, patch)
2011-09-02 05:50 PDT
,
Yuta Kitamura
no flags
Details
Formatted Diff
Diff
Patch for landing
(37.44 KB, patch)
2011-09-02 23:25 PDT
,
Yuta Kitamura
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Yuta Kitamura
Comment 1
2011-09-02 05:50:03 PDT
Created
attachment 106119
[details]
Patch
Kent Tamura
Comment 2
2011-09-02 07:20:50 PDT
Comment on
attachment 106119
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=106119&action=review
> LayoutTests/http/tests/websocket/tests/hybi/workers/resources/send-blob.js:-5 > -function startsWith(target, prefix) > -{ > - return target.indexOf(prefix) === 0; > -} > -
ChangeLog should mention the reason of this removal.
> Source/WebCore/ChangeLog:22 > + Rename "sent" to "sendResult" to clarify the meaning. Messages from the script may not be sent
nit: Hmm, the sent -> sendResult renaming looks not to improve the readability. sendRequestResult?
> Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:433 > + OwnPtr<Vector<char> > data = adoptPtr(new Vector<char>);
We had better add a comment why we need to copy the ArrayBuffer to the Vector.
> Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:436 > + data->resize(binaryData.byteLength()); > + if (binaryData.byteLength()) > + memcpy(data->data(), binaryData.data(), binaryData.byteLength());
resize() should be reserveCapacity(). Your code initializes the vector buffer twice.
Yuta Kitamura
Comment 3
2011-09-02 23:25:30 PDT
Created
attachment 106248
[details]
Patch for landing
Yuta Kitamura
Comment 4
2011-09-02 23:41:02 PDT
Comment on
attachment 106119
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=106119&action=review
Thank you for your comments!
>> LayoutTests/http/tests/websocket/tests/hybi/workers/resources/send-blob.js:-5 >> - > > ChangeLog should mention the reason of this removal.
Added to ChangeLog.
>> Source/WebCore/ChangeLog:22 >> + Rename "sent" to "sendResult" to clarify the meaning. Messages from the script may not be sent > > nit: > Hmm, the sent -> sendResult renaming looks not to improve the readability. sendRequestResult?
Renamed.
>> Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:433 >> + OwnPtr<Vector<char> > data = adoptPtr(new Vector<char>); > > We had better add a comment why we need to copy the ArrayBuffer to the Vector.
Added a comment.
>> Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:436 >> + memcpy(data->data(), binaryData.data(), binaryData.byteLength()); > > resize() should be reserveCapacity(). > Your code initializes the vector buffer twice.
I don't think using reserveCapaity() is right, for two reasons: - Initializing the vector elements will be turned into no-op, if the element type is primitive one. (VectorInitializer is doing some template magic) - reserveCapacity() does not change the size of the vector, so we must add elements anyway. Appending each element should not be better than memcpy(). However, I realized resize() is not necessary becase we can use Vector constructor instead. I update the patch to do this.
WebKit Review Bot
Comment 5
2011-09-03 00:44:30 PDT
Comment on
attachment 106248
[details]
Patch for landing Clearing flags on attachment: 106248 Committed
r94482
: <
http://trac.webkit.org/changeset/94482
>
WebKit Review Bot
Comment 6
2011-09-03 00:44:35 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug