On Fri, Feb 22, 2013 at 11:26 PM, Flying Jester <foolkingcr...@gmail.com>wrote:

> I recently updated the version of V8 I build my project against, and I was
> greeted with a new warning:
> warning: ‘void* v8::Object::GetPointerFromInternalField(int)’ is deprecated

v8's external API is currently changing a bit, and will probably continue
to do so for several months. Our general approach is to deprecate an API
entry for 1 stable version, giving embedders time to adapt, and remove it
after that. In the case at hand, GetPointerFromInternalField was deprecated
in 3.15 and removed in 3.16. If there is a more or less mechanical way to
replace a deprecated API entry, this will be noted in v8.h, e.g.:
* Gets a native pointer from an internal field. Deprecated. If the pointer
* always 2-byte-aligned, use GetAlignedPointerFromInternalField instead,
* otherwise use a combination of GetInternalField, External::Cast and
* External::Value.
V8EXPORT V8_DEPRECATED(void* GetPointerFromInternalField(int index)); In
general, v8.h is the most up-to-date form of "API documentation". The web
pages/tutorials might be out of sync and will get an overhaul at some later
point in time.

> I've seen the 'aligned' version of this function,
> GetAlignedPointerInInternalFie**ld. How would I go about replacing my
> usage of GetPointerFromInternalField with this new function? I don't use
> the setter function, I'm using GetPointerFromInternalField to get a C++
> side object from JS functions, like this:
>     v8::Local<v8::Object> color = v8::Local<v8::Object>::Cast(args[0]);
>     TS_Color* c = (TS_Color*)color->GetPointerFromInternalField(0);
> This obviously doesn't work with a 1 to 1 replacement with the aligned
> version of the function.

It depends: If you are sure that your TS_Color* is aligned, the aligned
version is an easy and extremely efficient 1:1 replacement. If you are
unsure, use the slow route as described in the comment.

v8-users mailing list
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to