Bug 73503

Summary: [Chromium][V8] Implement ArrayBuffer transfer in chromium
Product: WebKit Reporter: Dmitry Lomov <dslomov>
Component: WebCore Misc.Assignee: Dmitry Lomov <dslomov>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, japhet, kbr, levin, oliver, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 66578    
Attachments:
Description Flags
Implementation + tests
levin: review-, levin: commit-queue-
CR feedback
none
Rebased levin: review+

Dmitry Lomov
Reported 2011-11-30 17:06:10 PST
Implement ArrayBuffer transfer for SerializedScriptValue in chromium port.
Attachments
Implementation + tests (41.50 KB, patch)
2011-11-30 17:15 PST, Dmitry Lomov
levin: review-
levin: commit-queue-
CR feedback (43.59 KB, patch)
2011-11-30 18:45 PST, Dmitry Lomov
no flags
Rebased (43.61 KB, patch)
2011-11-30 19:19 PST, Dmitry Lomov
levin: review+
Dmitry Lomov
Comment 1 2011-11-30 17:15:51 PST
Created attachment 117303 [details] Implementation + tests
David Levin
Comment 2 2011-11-30 17:27:23 PST
Comment on attachment 117303 [details] Implementation + tests View in context: https://bugs.webkit.org/attachment.cgi?id=117303&action=review Just some high level cursory comments as I start to find my way in the code. > Source/JavaScriptCore/wtf/ArrayBuffer.h:-67 > - m_sizeInBytes = 0; In general resist the temptation to "clean up" trailing whitespace. > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1149 > else { Don't have an else if the condition ends with a return. > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1174 > + else if (V8ArrayBuffer::HasInstance(value)) { No { here due to single line statement. And don't have an else if the condition ends with a return. > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2145 > + OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); We really should have a static create method on Vector. > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2153 > + return PassOwnPtr<ArrayBufferContentsArray>(); Doesn't return 0 work? Or perhaps nullptr?
David Levin
Comment 3 2011-11-30 18:01:19 PST
Comment on attachment 117303 [details] Implementation + tests View in context: https://bugs.webkit.org/attachment.cgi?id=117303&action=review Only one more comment. Maybe we should do one more round. > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2154 > + } Weird issue here with half being neutered if an array buffer list more than once.
David Levin
Comment 4 2011-11-30 18:02:43 PST
(In reply to comment #3) > (From update of attachment 117303 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=117303&action=review > > Only one more comment. > > Maybe we should do one more round. > > > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2154 > > + } > > Weird issue here with half being neutered if an array buffer list more than once. I should have said this, but my review is basically complete. (The test is involved and I likely need to spend more time and brain power there but I'm done with the code.)
Dmitry Lomov
Comment 5 2011-11-30 18:43:29 PST
Comment on attachment 117303 [details] Implementation + tests View in context: https://bugs.webkit.org/attachment.cgi?id=117303&action=review >> Source/JavaScriptCore/wtf/ArrayBuffer.h:-67 >> - m_sizeInBytes = 0; > > In general resist the temptation to "clean up" trailing whitespace. Is it ok to keep this in the patch since I already did it? >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1149 >> else { > > Don't have an else if the condition ends with a return. There are other conditions in these series of if .. else .. that do not end with a return (see e.g. 'if(value->IsString())' branch above). I bet this can be beautified, but not in this patch.. >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1174 >> + else if (V8ArrayBuffer::HasInstance(value)) { > > No { here due to single line statement. > > And don't have an else if the condition ends with a return. First part - Done. Re return: see prev. comment. >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2145 >> + OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); > > We really should have a static create method on Vector. Not in this patch - what do you think? Although with all the typedefs it will be really hard to find all occurrences of this... >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2153 >> + return PassOwnPtr<ArrayBufferContentsArray>(); > > Doesn't return 0 work? Or perhaps nullptr? nullptr works - thanks! >>> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2154 >>> + } >> >> Weird issue here with half being neutered if an array buffer list more than once. > > I should have said this, but my review is basically complete. (The test is involved and I likely need to spend more time and brain power there but I'm done with the code.) Great catch - thank you very much!
Dmitry Lomov
Comment 6 2011-11-30 18:45:50 PST
Created attachment 117307 [details] CR feedback
David Levin
Comment 7 2011-11-30 19:15:48 PST
(In reply to comment #5) > (From update of attachment 117303 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=117303&action=review > >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1149 > >> else { > > > > Don't have an else if the condition ends with a return. > > There are other conditions in these series of if .. else .. that do not end with a return (see e.g. 'if(value->IsString())' branch above). I bet this can be beautified, but not in this patch.. Ok, I get it. I was suggesting introducing a bug... whoops. > >> Source/WebCore/bindings/v8/SerializedScriptValue.cpp:2145 > >> + OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size())); > > > > We really should have a static create method on Vector. > > Not in this patch - what do you think? Agreed. I should have been more clear. Looking over the tests...
Dmitry Lomov
Comment 8 2011-11-30 19:19:41 PST
David Levin
Comment 9 2011-11-30 22:19:50 PST
Comment on attachment 117307 [details] CR feedback View in context: https://bugs.webkit.org/attachment.cgi?id=117307&action=review I think we are missing an update to "fast/dom/Window/window-postmessage-args-expected.txt" > LayoutTests/fast/dom/Window/window-postmessage-args.html:66 > +if (!(arrayBuffer.byteLength ===0)) { Consider adding a space after ===
David Levin
Comment 10 2011-11-30 22:21:20 PST
Comment on attachment 117312 [details] Rebased Please consider the 2 comments from above (especially the updated of expected) and feel free to submit -- I thought I submit it a while ago but my change colilded with yours :).
Dmitry Lomov
Comment 11 2011-12-01 09:58:16 PST
Note You need to log in before you can comment on or make changes to this bug.