Skip to content

Commit

Permalink
Make sure callback classes are not assignable, copyable or movable.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa committed Aug 10, 2015
1 parent 98d38c1 commit 81f9b1d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions nan_callbacks_12_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ class FunctionCallbackInfo {
static const int kCalleeIndex = 5;
static const int kContextSaveIndex = 6;
static const int kArgsLength = 7;

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
};

template<typename T>
Expand Down Expand Up @@ -154,6 +157,9 @@ class PropertyCallbackInfo {
static const int kDataIndex = 4;
static const int kThisIndex = 5;
static const int kArgsLength = 6;

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo)
};

namespace imp {
Expand Down
6 changes: 6 additions & 0 deletions nan_callbacks_pre_12_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class FunctionCallbackInfo {
static const int kCalleeIndex = 5;
static const int kContextSaveIndex = 6;
static const int kArgsLength = 7;

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
};

template<typename T>
Expand Down Expand Up @@ -168,6 +171,9 @@ class PropertyCallbackInfoBase {
static const int kDataIndex = 4;
static const int kThisIndex = 5;
static const int kArgsLength = 6;

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase)
};

template<typename T>
Expand Down
1 change: 1 addition & 0 deletions nan_object_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class ObjectWrap {
int refs_; // ro

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap)
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))

Expand Down
1 change: 1 addition & 0 deletions nan_weak.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class WeakCallbackInfo {
}

private:
NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo)
Callback callback_;
v8::Isolate *isolate_;
void *parameter_;
Expand Down
4 changes: 2 additions & 2 deletions test/cpp/returnvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

using namespace Nan; // NOLINT(build/namespaces)

Global<v8::Boolean> global;
static Global<v8::Boolean> global;

NAN_METHOD(ReturnAValue) {
const FunctionCallbackInfo<v8::Value> cbinfo = info;
const FunctionCallbackInfo<v8::Value> &cbinfo = info;
ReturnValue<v8::Value> ret = cbinfo.GetReturnValue();
if (cbinfo.Length() == 1) {
ret.Set(info[0].As<v8::String>());
Expand Down

0 comments on commit 81f9b1d

Please sign in to comment.