Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: src/api.h

Issue 12729023: first step to remove unsafe handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: issue with debug build Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/shell.cc ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.h
diff --git a/src/api.h b/src/api.h
index a9563469fd1899cd86e2e70b4eb2b84b8f26f510..b9ffbf56c8b0a7131f1745b4a59427428780e315 100644
--- a/src/api.h
+++ b/src/api.h
@@ -291,12 +291,21 @@ v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom(
}
+class InternalHandleHelper {
+ 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); \
}
@@ -305,8 +314,8 @@ v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom(
v8::internal::Handle<v8::internal::JSTypedArray> obj) { \
ASSERT(obj.is_null() || !obj->IsTheHole()); \
ASSERT(obj->type() == typeConst); \
- return Local<v8::TypedArray>( \
- reinterpret_cast<v8::TypedArray*>(obj.location())); \
+ return InternalHandleHelper:: \
+ Convert<v8::internal::JSTypedArray, v8::TypedArray>(obj); \
}
« no previous file with comments | « samples/shell.cc ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698