Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2014-12-09 07:02:09 +0300
committerBert Belder <bertbelder@gmail.com>2014-12-09 19:57:17 +0300
commitbd83c3966d4564709e8449b3c699af6ece27ff12 (patch)
tree69be93abab35fb0ad8f5e13bfd28c89244488139 /src/udp_wrap.h
parentafe27e34cfc46e86334e2c17b6cbeb0afa316fff (diff)
async-wrap: explicitly pass parent
When instantiating a new AsyncWrap allow the parent AsyncWrap to be passed. This is useful for cases like TCP incoming connections, so the connection can be tied to the server receiving the connection. Because the current architecture instantiates the *Wrap inside a v8::FunctionCallback, the parent pointer is currently wrapped inside a new v8::External every time and passed as an argument. This adds ~80ns to instantiation time. A future optimization would be to add the v8::External as the data field when creating the v8::FunctionTemplate, change the pointer just before making the call then NULL'ing it out afterwards. This adds enough code complexity that it will not be attempted until the current approach demonstrates it is a bottle neck. PR-URL: https://github.com/joyent/node/pull/8110 Signed-off-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com> Reviewed-by: Alexis Campailla <alexis@janeasystems.com> Reviewed-by: Julien Gilli <julien.gilli@joyent.com>
Diffstat (limited to 'src/udp_wrap.h')
-rw-r--r--src/udp_wrap.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/udp_wrap.h b/src/udp_wrap.h
index fea298031ac..9e62d82c31f 100644
--- a/src/udp_wrap.h
+++ b/src/udp_wrap.h
@@ -22,6 +22,7 @@
#ifndef SRC_UDP_WRAP_H_
#define SRC_UDP_WRAP_H_
+#include "async-wrap.h"
#include "env.h"
#include "handle_wrap.h"
#include "req_wrap.h"
@@ -53,11 +54,11 @@ class UDPWrap: public HandleWrap {
static void SetBroadcast(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetTTL(const v8::FunctionCallbackInfo<v8::Value>& args);
- static v8::Local<v8::Object> Instantiate(Environment* env);
+ static v8::Local<v8::Object> Instantiate(Environment* env, AsyncWrap* parent);
uv_udp_t* UVHandle();
private:
- UDPWrap(Environment* env, v8::Handle<v8::Object> object);
+ UDPWrap(Environment* env, v8::Handle<v8::Object> object, AsyncWrap* parent);
static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
int family);