diff options
author | isaacs <i@izs.me> | 2012-04-13 03:03:47 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-04-18 00:14:54 +0400 |
commit | a26bee8fa16bcbdaafdee516288c6f59a43376f5 (patch) | |
tree | 33bdf31ce9891151c4d77ef785b86efb843b3d9e /src/pipe_wrap.cc | |
parent | db45b2ca02dc23278a477625a8698ce136eb8807 (diff) |
MakeCallback: Consistent symbol usage
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r-- | src/pipe_wrap.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 45902d4a883..8065461c69e 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -57,6 +57,9 @@ using v8::Boolean; Persistent<Function> pipeConstructor; +static Persistent<String> onconnection_sym; +static Persistent<String> oncomplete_sym; + // TODO share with TCPWrap? typedef class ReqWrap<uv_connect_t> ConnectWrap; @@ -215,7 +218,10 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) { // Successful accept. Call the onconnection callback in JavaScript land. Local<Value> argv[1] = { client_obj }; - MakeCallback(wrap->object_, "onconnection", 1, argv); + if (onconnection_sym.IsEmpty()) { + onconnection_sym = NODE_PSYMBOL("onconnection"); + } + MakeCallback(wrap->object_, onconnection_sym, ARRAY_SIZE(argv), argv); } // TODO Maybe share this with TCPWrap? @@ -247,7 +253,10 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { Local<Value>::New(Boolean::New(writable)) }; - MakeCallback(req_wrap->object_, "oncomplete", 5, argv); + if (oncomplete_sym.IsEmpty()) { + oncomplete_sym = NODE_PSYMBOL("oncomplete"); + } + MakeCallback(req_wrap->object_, oncomplete_sym, ARRAY_SIZE(argv), argv); delete req_wrap; } |