Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
// Allocates new storage via fastMalloc.
// Returns 0 if array failed to convert for any reason.
Allocates new storage via fastMalloc.
Returns 0 if array failed to convert for any reason.
Allocates new storage via fastMalloc . Returns 0 if array failed to convert for any reason .
static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len, ExceptionState& exceptionState)
{
    if (len > std::numeric_limits<uint32_t>::max() / sizeof(float)) {
        exceptionState.throwTypeError("Array length exceeds supported limit.");
        return 0;
    }
    float* data = static_cast<float*>(fastMalloc(len * sizeof(float)));
    for (uint32_t i = 0; i < len; i++) {
        v8::Local<v8::Value> val = array->Get(i);
        float value = toFloat(val, exceptionState);
        if (exceptionState.hadException()) {
            fastFree(data);
            return 0;
        }
        data[i] = value;
    }
    return data;
}
static float * jsArrayToFloatArray ( v8 :: Handle < v8 :: Array > array , uint32_t len , ExceptionState & exceptionState ) { if ( len > std :: numeric_limits < uint32_t > :: max ( ) / sizeof ( float ) ) { exceptionState . throwTypeError ( " " ) ; return 0 ; } float * data = static_cast < float * > ( fastMalloc ( len * sizeof ( float ) ) ) ; for ( uint32_t i = 0 ; i < len ; i ++ ) { v8 :: Local < v8 :: Value > val = array -> Get ( i ) ; float value = toFloat ( val , exceptionState ) ; if ( exceptionState . hadException ( ) ) { fastFree ( data ) ; return 0 ; } data [ i ] = value ; } return data ; }
Allocates new storage via fastMalloc.
Allocates new storage via fastMalloc .
// Convert the data element-by-element.