Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len)
{
    // Convert the data element-by-element.
    float* data;
    if (!tryFastMalloc(len * sizeof(float)).getValue(data))
        return 0;
    for (uint32_t i = 0; i < len; i++) {
        v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
        if (!val->IsNumber()) {
            fastFree(data);
            return 0;
        }
        data[i] = toFloat(val);
    }
    return data;
}
// Allocates new storage via tryFastMalloc.
// Returns NULL if array failed to convert for any reason.
Allocates new storage via tryFastMalloc.
Returns NULL if array failed to convert for any reason.
Allocates new storage via tryFastMalloc . Returns NULL if array failed to convert for any reason .
static float* jsArrayToFloatArray(v8::Handle<v8::Array> array, uint32_t len)
{
    float* data;
    if (!tryFastMalloc(len * sizeof(float)).getValue(data))
        return 0;
    for (uint32_t i = 0; i < len; i++) {
        v8::Local<v8::Value> val = array->Get(v8::Integer::New(i));
        if (!val->IsNumber()) {
            fastFree(data);
            return 0;
        }
        data[i] = toFloat(val);
    }
    return data;
}
static float * jsArrayToFloatArray ( v8 :: Handle < v8 :: Array > array , uint32_t len ) { float * data ; if ( ! tryFastMalloc ( len * sizeof ( float ) ) . getValue ( data ) ) return 0 ; for ( uint32_t i = 0 ; i < len ; i ++ ) { v8 :: Local < v8 :: Value > val = array -> Get ( v8 :: Integer :: New ( i ) ) ; if ( ! val -> IsNumber ( ) ) { fastFree ( data ) ; return 0 ; } data [ i ] = toFloat ( val ) ; } return data ; }
Allocates new storage via tryFastMalloc.
Allocates new storage via tryFastMalloc .
// Convert the data element-by-element.