Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Issue 1091543002: IDL: Add [FlexibleArrayBufferView] and use for bufferSubData

Created:
5 years, 8 months ago by Jens Widell
Modified:
5 years, 8 months ago
CC:
aandrey+blink_chromium.org, arv+blink, bajones, blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, Rik, Inactive, dglazkov+blink, dshwang, eae+blinkwatch, Justin Novosad, rwlbuis, sof, vivekg_samsung, vivekg, Zhenyao Mo
Base URL:
https://chromium.googlesource.com/chromium/blink.git@idl-includes-for-type-tuning
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

IDL: Add [FlexibleArrayBufferView] and use for bufferSubData The [FlexibleArrayBufferView] extended attribute, when used on a method argument of type ArrayBufferView, causes the value to be processed and passed to the implementation as the new C++ type FlexibleArrayBufferView instead of as DOMArrayBufferView*. A FlexibleArrayBufferView object will either contain a pointer to a DOMArrayBufferView, or, if the array was small (without a materialized buffer), a stack allocated buffer containing the contents of the array. BUG=v8:3996

Patch Set 1 #

Patch Set 2 : make FlexibleArrayBufferView non-copyable #

Patch Set 3 : add warning about the storage's life-time #

Unified diffs Side-by-side diffs Delta from patch set Stats (+120 lines, -6 lines) Patch
M Source/bindings/IDLExtendedAttributes.txt View 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/core/v8/V8Binding.h View 1 2 chunks +7 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/V8Binding.cpp View 1 3 chunks +16 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/V8BindingMacros.h View 1 chunk +3 lines, -0 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 5 chunks +11 lines, -2 lines 0 comments Download
M Source/bindings/tests/idls/core/TestObject.idl View 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestObject.cpp View 1 3 chunks +23 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A Source/core/dom/FlexibleArrayBufferView.h View 1 2 1 chunk +51 lines, -0 lines 0 comments Download
M Source/core/html/canvas/WebGLRenderingContextBase.h View 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/html/canvas/WebGLRenderingContextBase.cpp View 2 chunks +3 lines, -2 lines 0 comments Download
M Source/core/html/canvas/WebGLRenderingContextBase.idl View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (1 generated)
Jens Widell
PTAL This is a reworked version of https://codereview.chromium.org/1079983002/, achieving the same thing effectively. Using an ...
5 years, 8 months ago (2015-04-15 11:49:34 UTC) #2
jochen (gone - plz use gerrit)
in the end, the data is copied here to gl: https://code.google.com/p/chromium/codesearch#chromium/src/gpu/command_buffer/client/gles2_implementation.cc&rcl=1429084052&l=1469 Ideally, we'd not alloca() ...
5 years, 8 months ago (2015-04-15 12:59:50 UTC) #3
Ken Russell (switch to Gerrit)
On 2015/04/15 12:59:50, jochen wrote: > in the end, the data is copied here to ...
5 years, 8 months ago (2015-04-16 05:56:52 UTC) #4
Jens Widell
On 2015/04/16 05:56:52, Ken Russell (OOO until 4-21) wrote: > On 2015/04/15 12:59:50, jochen wrote: ...
5 years, 8 months ago (2015-04-16 08:51:15 UTC) #5
jochen (gone - plz use gerrit)
On 2015/04/16 at 08:51:15, jl wrote: > On 2015/04/16 05:56:52, Ken Russell (OOO until 4-21) ...
5 years, 8 months ago (2015-04-16 14:39:51 UTC) #6
Jens Widell
On 2015/04/16 14:39:51, jochen wrote: > On 2015/04/16 at 08:51:15, jl wrote: > > On ...
5 years, 8 months ago (2015-04-16 15:15:37 UTC) #7
jochen (gone - plz use gerrit)
what about changing this so the Flexible thing has the following methods: bool HasBuffer() size_t ...
5 years, 8 months ago (2015-04-22 14:10:29 UTC) #8
Jens Widell
On 2015/04/22 14:10:29, jochen wrote: > what about changing this so the Flexible thing has ...
5 years, 8 months ago (2015-04-22 14:14:29 UTC) #9
Ken Russell (switch to Gerrit)
On 2015/04/22 14:10:29, jochen wrote: > what about changing this so the Flexible thing has ...
5 years, 8 months ago (2015-04-23 23:14:30 UTC) #10
jochen (gone - plz use gerrit)
On 2015/04/23 at 23:14:30, kbr wrote: > On 2015/04/22 14:10:29, jochen wrote: > > what ...
5 years, 8 months ago (2015-04-24 14:02:30 UTC) #11
jochen (gone - plz use gerrit)
On 2015/04/23 at 23:14:30, kbr wrote: > On 2015/04/22 14:10:29, jochen wrote: > > what ...
5 years, 8 months ago (2015-04-24 14:02:31 UTC) #12
Ken Russell (switch to Gerrit)
5 years, 8 months ago (2015-04-24 21:46:26 UTC) #13
On 2015/04/24 14:02:31, jochen wrote:
> On 2015/04/23 at 23:14:30, kbr wrote:
> > On 2015/04/22 14:10:29, jochen wrote:
> > > what about changing this so the Flexible thing has the following methods:
> > > 
> > > bool HasBuffer()
> > > size_t Length()
> > > void CopyOut(void*, size_t byteLen)
> > > DOMArrayBufferView* GetBuffer()
> > > 
> > > internally, it keeps a Local<ArrayBufferView> and it's non-copyable
> > > 
> > > Then bufferSubData() has to do the alloca() if it wants to, however, if we
> > > decide to change the gl thing to avoid the alloca, we don't have to change
> > > FlexibleArrayBufferView (also, it's then safe to use)
> > 
> > That means every user of FlexibleArrayBufferView has to have code to alloca
> and copy out the contents. I think it is better if FlexibleArrayBufferView
> encapsulates these details.
> 
> as long as the users alloca() using a FlexibleArrayBufferView is pointless -
it
> doesn't save anything.

I like the current structure of the code and would not like to see alloca()
calls being made outside the bindings or FlexibleArrayBufferView class. I also
like the fact that WebGLRenderingContextBase only had to be changed trivially to
support small array buffers.

The current patch set LGTM.


> > 
> > > kbr@ we could change the gl API to return a buffer to copy into, then we
> don't
> > > need to pass the ArrayBufferView down, wdyt?
> > 
> > I don't see how that would work. bufferSubData would then be split up into
two
> calls? One to get the destination buffer, and one to actually submit it?
That's
> overly complicated. I like the current structure better.

Powered by Google App Engine
This is Rietveld 408576698