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

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: 1 month rebase 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
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)

Powered by Google App Engine
This is Rietveld 408576698