[Pkg-javascript-commits] [node-leveldown] 262/492: V8 upgrade requiring `isolate` argument

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit cc48eefaeb13638dff3798345337fd00c8df1b5f
Author: Rod Vagg <rod at vagg.org>
Date:   Wed Mar 20 12:15:16 2013 +1100

    V8 upgrade requiring `isolate` argument
---
 src/async.cc          |  2 +-
 src/batch.cc          | 19 ++++++++++++++-----
 src/database.cc       | 30 ++++++++++++++++++++----------
 src/database_async.cc | 12 ++++++------
 src/iterator.cc       | 16 +++++++++++-----
 src/leveldown.h       | 16 +++++++++++++++-
 6 files changed, 67 insertions(+), 28 deletions(-)

diff --git a/src/async.cc b/src/async.cc
index 6b58c4e..52c2926 100644
--- a/src/async.cc
+++ b/src/async.cc
@@ -30,7 +30,7 @@ void AsyncWorker::WorkComplete () {
     HandleOKCallback();
   else
     HandleErrorCallback();
-  callback.Dispose();
+  callback.Dispose(LD_NODE_ISOLATE);
 }
 
 void AsyncWorker::HandleOKCallback () {
diff --git a/src/batch.cc b/src/batch.cc
index fa10f14..a1394a7 100644
--- a/src/batch.cc
+++ b/src/batch.cc
@@ -20,7 +20,7 @@ Batch::~Batch () {
   for (std::vector< v8::Persistent<v8::Value> >::iterator it = references->begin()
       ; it != references->end()
       ; ) {
-    it->Dispose();
+    it->Dispose(LD_NODE_ISOLATE);
     it = references->erase(it);
   }
   delete references;
@@ -52,7 +52,9 @@ void Batch::Init () {
       v8::String::NewSymbol("write")
     , v8::FunctionTemplate::New(Batch::Write)->GetFunction()
   );
-  constructor = v8::Persistent<v8::Function>::New(tpl->GetFunction());
+  constructor = v8::Persistent<v8::Function>::New(
+      LD_NODE_ISOLATE_PRE
+      tpl->GetFunction());
 }
 
 v8::Handle<v8::Value> Batch::New (const v8::Arguments& args) {
@@ -107,9 +109,13 @@ v8::Handle<v8::Value> Batch::Put (const v8::Arguments& args) {
   LD_STRING_OR_BUFFER_TO_SLICE(value, valueBuffer, value)
 
   if (node::Buffer::HasInstance(keyBuffer->ToObject()))
-    batch->references->push_back(v8::Persistent<v8::Value>::New(keyBuffer));
+    batch->references->push_back(v8::Persistent<v8::Value>::New(
+        LD_NODE_ISOLATE_PRE
+        keyBuffer));
   if (node::Buffer::HasInstance(valueBuffer->ToObject()))
-    batch->references->push_back(v8::Persistent<v8::Value>::New(valueBuffer));
+    batch->references->push_back(v8::Persistent<v8::Value>::New(
+        LD_NODE_ISOLATE_PRE
+        valueBuffer));
 
   batch->batch->Put(key, value);
 
@@ -128,7 +134,9 @@ v8::Handle<v8::Value> Batch::Del (const v8::Arguments& args) {
   LD_STRING_OR_BUFFER_TO_SLICE(key, keyBuffer, key)
 
   if (node::Buffer::HasInstance(keyBuffer->ToObject()))
-    batch->references->push_back(v8::Persistent<v8::Value>::New(keyBuffer));
+    batch->references->push_back(v8::Persistent<v8::Value>::New(
+        LD_NODE_ISOLATE_PRE
+        keyBuffer));
 
   batch->batch->Delete(key);
 
@@ -152,6 +160,7 @@ v8::Handle<v8::Value> Batch::Write (const v8::Arguments& args) {
     LD_THROW_RETURN(name() requires a callback argument)
   }
   v8::Persistent<v8::Function> callback = v8::Persistent<v8::Function>::New(
+      LD_NODE_ISOLATE_PRE
       v8::Local<v8::Function>::Cast(args[0]));
 
   BatchWriteWorker* worker  = new BatchWriteWorker(batch, callback);
diff --git a/src/database.cc b/src/database.cc
index 9228cdf..76cdfa8 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -137,7 +137,9 @@ void Database::Init () {
       v8::String::NewSymbol("iterator")
     , v8::FunctionTemplate::New(Iterator)->GetFunction()
   );
-  constructor = v8::Persistent<v8::Function>::New(tpl->GetFunction());
+  constructor = v8::Persistent<v8::Function>::New(
+      LD_NODE_ISOLATE_PRE
+      tpl->GetFunction());
 }
 
 v8::Handle<v8::Value> Database::New (const v8::Arguments& args) {
@@ -224,9 +226,9 @@ v8::Handle<v8::Value> Database::Put (const v8::Arguments& args) {
   LD_STRING_OR_BUFFER_TO_SLICE(value, valueBufferV, value)
 
   v8::Persistent<v8::Value> keyBuffer =
-      v8::Persistent<v8::Value>::New(keyBufferV);
+      v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE keyBufferV);
   v8::Persistent<v8::Value> valueBuffer =
-      v8::Persistent<v8::Value>::New(valueBufferV);
+      v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE valueBufferV);
 
   LD_BOOLEAN_OPTION_VALUE(optionsObj, sync)
 
@@ -254,7 +256,9 @@ v8::Handle<v8::Value> Database::Get (const v8::Arguments& args) {
   v8::Local<v8::Value> keyBufferV = args[0];
   LD_STRING_OR_BUFFER_TO_SLICE(key, keyBufferV, key)
 
-  v8::Persistent<v8::Value> keyBuffer = v8::Persistent<v8::Value>::New(keyBufferV);
+  v8::Persistent<v8::Value> keyBuffer = v8::Persistent<v8::Value>::New(
+      LD_NODE_ISOLATE_PRE
+      keyBufferV);
 
   LD_BOOLEAN_OPTION_VALUE_DEFTRUE(optionsObj, asBuffer)
   LD_BOOLEAN_OPTION_VALUE_DEFTRUE(optionsObj, fillCache)
@@ -283,7 +287,7 @@ v8::Handle<v8::Value> Database::Delete (const v8::Arguments& args) {
   LD_STRING_OR_BUFFER_TO_SLICE(key, keyBufferV, key)
 
   v8::Persistent<v8::Value> keyBuffer =
-      v8::Persistent<v8::Value>::New(keyBufferV);
+      v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE keyBufferV);
 
   LD_BOOLEAN_OPTION_VALUE(optionsObj, sync)
 
@@ -343,7 +347,9 @@ v8::Handle<v8::Value> Database::Batch (const v8::Arguments& args) {
 
       batch->Delete(key);
       if (node::Buffer::HasInstance(keyBuffer->ToObject()))
-        references->push_back(v8::Persistent<v8::Value>::New(keyBuffer));
+        references->push_back(v8::Persistent<v8::Value>::New(
+            LD_NODE_ISOLATE_PRE
+            keyBuffer));
     } else if (obj->Get(str_type)->StrictEquals(str_put)) {
       v8::Local<v8::Value> valueBuffer = obj->Get(str_value);
       LD_CB_ERR_IF_NULL_OR_UNDEFINED(valueBuffer, value)
@@ -353,9 +359,13 @@ v8::Handle<v8::Value> Database::Batch (const v8::Arguments& args) {
 
       batch->Put(key, value);
       if (node::Buffer::HasInstance(keyBuffer->ToObject()))
-        references->push_back(v8::Persistent<v8::Value>::New(keyBuffer));
+        references->push_back(v8::Persistent<v8::Value>::New(
+            LD_NODE_ISOLATE_PRE
+            keyBuffer));
       if (node::Buffer::HasInstance(valueBuffer->ToObject()))
-        references->push_back(v8::Persistent<v8::Value>::New(valueBuffer));
+        references->push_back(v8::Persistent<v8::Value>::New(
+            LD_NODE_ISOLATE_PRE
+            valueBuffer));
     }
   }
 
@@ -395,9 +405,9 @@ v8::Handle<v8::Value> Database::ApproximateSize (const v8::Arguments& args) {
   LD_STRING_OR_BUFFER_TO_SLICE(end, endBufferV, end)
 
   v8::Persistent<v8::Value> startBuffer =
-      v8::Persistent<v8::Value>::New(startBufferV);
+      v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE startBufferV);
   v8::Persistent<v8::Value> endBuffer =
-      v8::Persistent<v8::Value>::New(endBufferV);
+      v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE endBufferV);
 
   ApproximateSizeWorker* worker  = new ApproximateSizeWorker(
       database
diff --git a/src/database_async.cc b/src/database_async.cc
index 0422e0b..644ef35 100644
--- a/src/database_async.cc
+++ b/src/database_async.cc
@@ -58,7 +58,7 @@ void CloseWorker::Execute () {
 void CloseWorker::WorkComplete () {
   v8::HandleScope scope;
   HandleOKCallback();
-  callback.Dispose();
+  callback.Dispose(LD_NODE_ISOLATE);
 }
 
 /** IO WORKER (abstract) **/
@@ -77,7 +77,7 @@ IOWorker::~IOWorker () {}
 
 void IOWorker::WorkComplete () {
   AsyncWorker::WorkComplete();
-  keyPtr.Dispose();
+  keyPtr.Dispose(LD_NODE_ISOLATE);
 }
 
 /** READ WORKER **/
@@ -164,7 +164,7 @@ void WriteWorker::Execute () {
 
 void WriteWorker::WorkComplete () {
   IOWorker::WorkComplete();
-  valuePtr.Dispose();
+  valuePtr.Dispose(LD_NODE_ISOLATE);
 }
 
 /** BATCH WORKER **/
@@ -187,7 +187,7 @@ BatchWorker::~BatchWorker () {
   for (std::vector< v8::Persistent<v8::Value> >::iterator it = references->begin()
       ; it != references->end()
       ; ) {
-    it->Dispose();
+    it->Dispose(LD_NODE_ISOLATE);
     it = references->erase(it);
   }
   delete references;
@@ -221,8 +221,8 @@ void ApproximateSizeWorker::Execute () {
 
 void ApproximateSizeWorker::WorkComplete() {
   AsyncWorker::WorkComplete();
-  startPtr.Dispose();
-  endPtr.Dispose();
+  startPtr.Dispose(LD_NODE_ISOLATE);
+  endPtr.Dispose(LD_NODE_ISOLATE);
 }
 
 void ApproximateSizeWorker::HandleOKCallback () {
diff --git a/src/iterator.cc b/src/iterator.cc
index 002a747..b6b9cd4 100644
--- a/src/iterator.cc
+++ b/src/iterator.cc
@@ -47,7 +47,7 @@ Iterator::Iterator (
 
 Iterator::~Iterator () {
   delete options;
-  startPtr.Dispose();
+  startPtr.Dispose(LD_NODE_ISOLATE);
   if (start != NULL)
     delete start;
   if (end != NULL)
@@ -130,7 +130,9 @@ v8::Handle<v8::Value> Iterator::Next (const v8::Arguments& args) {
   }
 
   v8::Persistent<v8::Function> callback =
-      v8::Persistent<v8::Function>::New(v8::Local<v8::Function>::Cast(args[0]));
+      v8::Persistent<v8::Function>::New(
+          LD_NODE_ISOLATE_PRE
+          v8::Local<v8::Function>::Cast(args[0]));
 
   NextWorker* worker = new NextWorker(
       iterator
@@ -156,7 +158,9 @@ v8::Handle<v8::Value> Iterator::End (const v8::Arguments& args) {
   }
 
   v8::Persistent<v8::Function> callback =
-      v8::Persistent<v8::Function>::New(v8::Local<v8::Function>::Cast(args[0]));
+      v8::Persistent<v8::Function>::New(
+          LD_NODE_ISOLATE_PRE
+          v8::Local<v8::Function>::Cast(args[0]));
 
   EndWorker* worker = new EndWorker(
       iterator
@@ -188,7 +192,9 @@ void Iterator::Init () {
       v8::String::NewSymbol("end")
     , v8::FunctionTemplate::New(End)->GetFunction()
   );
-  constructor = v8::Persistent<v8::Function>::New(tpl->GetFunction());
+  constructor = v8::Persistent<v8::Function>::New(
+      LD_NODE_ISOLATE_PRE
+      tpl->GetFunction());
 }
 
 v8::Handle<v8::Value> Iterator::NewInstance (
@@ -271,7 +277,7 @@ v8::Handle<v8::Value> Iterator::New (const v8::Arguments& args) {
     , fillCache
     , keyAsBuffer
     , valueAsBuffer
-    , v8::Persistent<v8::Value>::New(startBuffer)
+    , v8::Persistent<v8::Value>::New(LD_NODE_ISOLATE_PRE startBuffer)
   );
   iterator->Wrap(args.This());
 
diff --git a/src/leveldown.h b/src/leveldown.h
index 5ff6356..43377dd 100644
--- a/src/leveldown.h
+++ b/src/leveldown.h
@@ -5,9 +5,20 @@
 #ifndef LD_LEVELDOWN_H
 #define LD_LEVELDOWN_H
 
+// node_isolate stuff introduced with V8 upgrade, see https://github.com/joyent/node/pull/5077
+#if NODE_MODULE_VERSION > 0x000B
+#  define LD_NODE_ISOLATE node::node_isolate
+#  define LD_NODE_ISOLATE_PRE node::node_isolate, 
+#  define LD_NODE_ISOLATE_POST , node::node_isolate 
+#else
+#  define LD_NODE_ISOLATE
+#  define LD_NODE_ISOLATE_PRE
+#  define LD_NODE_ISOLATE_POST
+#endif
+
 #define LD_SYMBOL(var, key) \
   static const v8::Persistent<v8::String> var = \
-    v8::Persistent<v8::String>::New(v8::String::NewSymbol(#key));
+    v8::Persistent<v8::String>::New(LD_NODE_ISOLATE_PRE v8::String::NewSymbol(#key));
 
 #define LD_V8_METHOD(name) \
   static v8::Handle<v8::Value> name (const v8::Arguments& args);
@@ -105,10 +116,12 @@
   v8::Persistent<v8::Function> callback; \
   if (optionPos == -1 && args[callbackPos]->IsFunction()) { \
     callback = v8::Persistent<v8::Function>::New( \
+      LD_NODE_ISOLATE_PRE \
       v8::Local<v8::Function>::Cast(args[callbackPos]) \
     ); \
   } else if (optionPos != -1 && args[callbackPos - 1]->IsFunction()) { \
     callback = v8::Persistent<v8::Function>::New( \
+      LD_NODE_ISOLATE_PRE \
       v8::Local<v8::Function>::Cast(args[callbackPos - 1]) \
     ); \
   } else if (optionPos != -1 \
@@ -116,6 +129,7 @@
         && args[callbackPos]->IsFunction()) { \
     optionsObj = v8::Local<v8::Object>::Cast(args[optionPos]); \
     callback = v8::Persistent<v8::Function>::New( \
+      LD_NODE_ISOLATE_PRE \
       v8::Local<v8::Function>::Cast(args[callbackPos]) \
     ); \
   } else { \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list