Set proxied methods wrappers in `TLSWrap` prototype instead of doing it
on every socket allocation. Should speed up things a bit and will
certainly make heapsnapshot less verbose.
PR-URL: https://github.com/iojs/io.js/pull/1108
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
'setPendingInstances'
];
+// Proxy HandleWrap, PipeWrap and TCPWrap methods
+proxiedMethods.forEach(function(name) {
+ tls_wrap.TLSWrap.prototype[name] = function methodProxy() {
+ if (this._parent[name])
+ return this._parent[name].apply(this._parent, arguments);
+ };
+});
+
TLSSocket.prototype._wrapHandle = function(handle) {
var res;
}
});
- // Proxy HandleWrap, PipeWrap and TCPWrap methods
- proxiedMethods.forEach(function(name) {
- res[name] = function methodProxy() {
- if (handle[name])
- return handle[name].apply(handle, arguments);
- };
- });
-
return res;
};
void TLSWrap::Initialize(Handle<Object> target,
- Handle<Value> unused,
- Handle<Context> context) {
+ Handle<Value> unused,
+ Handle<Context> context) {
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "wrap", TLSWrap::Wrap);
env->set_tls_wrap_constructor_template(t);
env->set_tls_wrap_constructor_function(t->GetFunction());
+
+ target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "TLSWrap"),
+ t->GetFunction());
}
} // namespace node