Chromium Code Reviews| Index: src/api.h |
| diff --git a/src/api.h b/src/api.h |
| index 0cd16f1f01f4fcc60d9c3deb5c6ad34fe725a326..4a30c7e917bc0bd75bf77046714913af200c78a4 100644 |
| --- a/src/api.h |
| +++ b/src/api.h |
| @@ -259,12 +259,21 @@ v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
| } |
| +class InternalHandleHelper { |
|
Sven Panne
2013/04/30 07:31:22
Why do we need to stuff this template into a helpe
dcarney
2013/04/30 07:43:21
I made this helper class a friend of Persistent an
|
| + public: |
| + template<class From, class To> |
| + static inline Local<To> Convert(v8::internal::Handle<From> obj) { |
| + return Local<To>(reinterpret_cast<To*>(obj.location())); |
| + } |
| +}; |
| + |
| + |
| // Implementations of ToLocal |
| #define MAKE_TO_LOCAL(Name, From, To) \ |
| Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ |
| ASSERT(obj.is_null() || !obj->IsTheHole()); \ |
| - return Local<To>(reinterpret_cast<To*>(obj.location())); \ |
| + return InternalHandleHelper::Convert<v8::internal::From, v8::To>(obj); \ |
| } |
| MAKE_TO_LOCAL(ToLocal, Context, Context) |