Permalink
Browse files

Fixes compilation for node 0.6.x

  • Loading branch information...
1 parent d2999f3 commit c2d80c1c3bc58b8c1d7ca7d04cfabb983948df60 @c4milo committed Apr 1, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 graph_node.cc
View
12 graph_node.cc
@@ -1,5 +1,6 @@
#include "graph_node.h"
#include "graph_edge.h"
+#include "node_version.h"
using namespace v8;
@@ -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));
}

0 comments on commit c2d80c1

Please sign in to comment.