Skip to content

Commit 32f1eea

Browse files
committed
update to work with node v0.10.x
1 parent 40f3320 commit 32f1eea

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/java.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "javaScope.h"
1010
#include "methodCallBaton.h"
1111
#include "node_NodeDynamicProxyClass.h"
12+
#include <node_version.h>
1213
#include <sstream>
1314

1415
std::string nativeBindingLocation;
@@ -650,7 +651,11 @@ v8::Handle<v8::Value> Java::createJVM(JavaVM** jvm, JNIEnv** env) {
650651
void EIO_CallJs(uv_work_t* req) {
651652
}
652653

654+
#if NODE_MINOR_VERSION >= 10
655+
void EIO_AfterCallJs(uv_work_t* req, int status) {
656+
#else
653657
void EIO_AfterCallJs(uv_work_t* req) {
658+
#endif
654659
DynamicProxyData* dynamicProxyData = static_cast<DynamicProxyData*>(req->data);
655660
if(!dynamicProxyDataVerify(dynamicProxyData)) {
656661
return;
@@ -726,7 +731,11 @@ JNIEXPORT jobject JNICALL Java_node_NodeDynamicProxyClass_callJs(JNIEnv *env, jo
726731
uv_work_t* req = new uv_work_t();
727732
req->data = dynamicProxyData;
728733
if(myThreadId == v8ThreadId) {
734+
#if NODE_MINOR_VERSION >= 10
735+
EIO_AfterCallJs(req, 0);
736+
#else
729737
EIO_AfterCallJs(req);
738+
#endif
730739
} else {
731740
uv_queue_work(uv_default_loop(), req, EIO_CallJs, EIO_AfterCallJs);
732741

src/methodCallBaton.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ v8::Handle<v8::Value> MethodCallBaton::runSync() {
5050
javaDetachCurrentThread(self->m_java->getJvm());
5151
}
5252

53+
#if NODE_MINOR_VERSION >= 10
54+
/*static*/ void MethodCallBaton::EIO_AfterMethodCall(uv_work_t* req, int status) {
55+
#else
5356
/*static*/ void MethodCallBaton::EIO_AfterMethodCall(uv_work_t* req) {
57+
#endif
5458
MethodCallBaton* self = static_cast<MethodCallBaton*>(req->data);
5559
JNIEnv *env = self->m_java->getJavaEnv();
5660
self->after(env);

src/methodCallBaton.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "utils.h"
66
#include <v8.h>
77
#include <node.h>
8+
#include <node_version.h>
89
#include <jni.h>
910
#include <list>
1011

@@ -17,7 +18,11 @@ class MethodCallBaton {
1718
virtual ~MethodCallBaton();
1819

1920
static void EIO_MethodCall(uv_work_t* req);
21+
#if NODE_MINOR_VERSION >= 10
22+
static void EIO_AfterMethodCall(uv_work_t* req, int status);
23+
#else
2024
static void EIO_AfterMethodCall(uv_work_t* req);
25+
#endif
2126
void run();
2227
v8::Handle<v8::Value> runSync();
2328

0 commit comments

Comments
 (0)