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

Unified Diff: include/v8.h

Issue 11316331: Pass Isolate to Local<T>::New() (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Isolate argument first Created 8 years 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 | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 74f489d2ab7870bba38e7bb46dfd10b1bba93401..dccbd99204d28fe868828ec24ac8cf1b5647639b 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -305,6 +305,7 @@ template <class T> class Local : public Handle<T> {
* the original handle is destroyed/disposed.
*/
inline static Local<T> New(Handle<T> that);
+ inline static Local<T> New(Isolate* isolate, Handle<T> that);
};
@@ -486,6 +487,8 @@ class V8EXPORT HandleScope {
* Creates a new handle with the given value.
*/
static internal::Object** CreateHandle(internal::Object* value);
+ static internal::Object** CreateHandle(internal::Isolate* isolate,
+ internal::Object* value);
// Faster version, uses HeapObject to obtain the current Isolate.
static internal::Object** CreateHandle(internal::HeapObject* value);
@@ -4275,6 +4278,16 @@ Local<T> Local<T>::New(Handle<T> that) {
template <class T>
+ Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) {
+ if (that.IsEmpty()) return Local<T>();
+ T* that_ptr = *that;
+ internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
+ return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
+ reinterpret_cast<internal::Isolate*>(isolate), *p)));
+}
+
+
+template <class T>
Persistent<T> Persistent<T>::New(Handle<T> that) {
if (that.IsEmpty()) return Persistent<T>();
internal::Object** p = reinterpret_cast<internal::Object**>(*that);
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698