Skip to content

Commit

Permalink
Fixes compilation for node 0.6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
c4milo committed Apr 1, 2012
1 parent d2999f3 commit c2d80c1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions graph_node.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "graph_node.h"
#include "graph_edge.h"
#include "node_version.h"

using namespace v8;

Expand Down Expand Up @@ -124,9 +125,20 @@ Handle<Value> GraphNode::GetChild(const Arguments& args) {

Handle<Value> GraphNode::GetRetainedSize(const Arguments& args) {
HandleScope scope;

Handle<Object> self = args.This();
void* ptr = self->GetPointerFromInternalField(0);

#if NODE_VERSION_AT_LEAST(0, 7, 0)
int32_t size = static_cast<HeapGraphNode*>(ptr)->GetRetainedSize();
#else
bool exact = false;
if (args.Length() > 0) {
exact = args[0]->BooleanValue();
}
int32_t size = static_cast<HeapGraphNode*>(ptr)->GetRetainedSize(exact);
#endif

return scope.Close(Integer::New(size));
}

Expand Down

0 comments on commit c2d80c1

Please sign in to comment.