I agree that SetIndexedPropertiesToExternalArrayData which was introduced only a few weeks ago is probably closer to what you want.
I've looked through the code anyway. Except for giving out a derived pointer (see below) it looks okay to me. http://codereview.chromium.org/391068/diff/1/3 File src/api.cc (right): http://codereview.chromium.org/391068/diff/1/3#newcode1657 Line 1657: "Could not convert to external"); I expect you mean "...to blob". http://codereview.chromium.org/391068/diff/1/3#newcode2982 Line 2982: i::Handle<i::Object> obj = Utils::OpenHandle(this); Doesn't OpenHandle give you back a ByteArray that you can just use without casting? http://codereview.chromium.org/391068/diff/1/3#newcode3004 Line 3004: return i::ByteArray::cast(*obj)->GetDataStartAddress(); Danger danger! This will give you a derived pointer which may be invalidated by the GC at any time. The only thing you can do safely is block read/write like we do on strings. http://codereview.chromium.org/391068/diff/1/5 File test/cctest/test-api.cc (right): http://codereview.chromium.org/391068/diff/1/5#newcode1414 Line 1414: env->Global()->Set(v8_str("blob"), blob); Like externals it is not safe to expose blobs directly to JavaScript code. You have to wrap it as an internal field of a v8::Object. http://codereview.chromium.org/391068 --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
