From c79d5163e530892c62b08d8b814b588220c26ec8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 25 Sep 2013 12:57:03 +0200 Subject: [PATCH] src: remove ObjectWrap dependency from core Drop the ObjectWrap dependency in favor of an internal WeakObject class. Let's us stop worrying about API and ABI compatibility when making changes to the way node.js deals with weakly persistent handles internally. --- node.gyp | 2 + src/node_contextify.cc | 15 ++++-- src/node_crypto.cc | 135 +++++++++++++++++++++-------------------------- src/node_crypto.h | 62 +++++++++++++++------- src/node_http_parser.cc | 27 +++++----- src/node_stat_watcher.cc | 21 ++++---- src/node_stat_watcher.h | 5 +- src/node_zlib.cc | 34 ++++++------ src/tls_wrap.cc | 18 +++---- src/tls_wrap.h | 8 +-- src/weak-object-inl.h | 71 +++++++++++++++++++++++++ src/weak-object.h | 54 +++++++++++++++++++ 12 files changed, 297 insertions(+), 155 deletions(-) create mode 100644 src/weak-object-inl.h create mode 100644 src/weak-object.h diff --git a/node.gyp b/node.gyp index 3ff177a..7947a23 100644 --- a/node.gyp +++ b/node.gyp @@ -144,6 +144,8 @@ 'src/tree.h', 'src/util.h', 'src/util-inl.h', + 'src/weak-object.h', + 'src/weak-object-inl.h', 'deps/http_parser/http_parser.h', '<(SHARED_INTERMEDIATE_DIR)/node_natives.h', # javascript files to make for an even more pleasant IDE experience diff --git a/src/node_contextify.cc b/src/node_contextify.cc index c76b99d..ca281df 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -24,6 +24,8 @@ #include "node_watchdog.h" #include "env.h" #include "env-inl.h" +#include "weak-object.h" +#include "weak-object-inl.h" namespace node { @@ -304,7 +306,7 @@ class ContextifyContext { } }; -class ContextifyScript : public ObjectWrap { +class ContextifyScript : public WeakObject { private: Persistent