Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
src: reading/owner/onread/onconnection for tcp
Browse files Browse the repository at this point in the history
Initialize fields to avoid Hidden Class creation in runtime.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
JacksonTian authored and indutny committed Sep 2, 2014
1 parent 53fc14c commit 92419f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/tcp_wrap.cc
Expand Up @@ -50,6 +50,7 @@ using v8::PropertyAttribute;
using v8::String;
using v8::Undefined;
using v8::Value;
using v8::Boolean;

typedef class ReqWrap<uv_connect_t> ConnectWrap;

Expand Down Expand Up @@ -83,6 +84,18 @@ void TCPWrap::Initialize(Handle<Object> target,
v8::DEFAULT,
attributes);

// Init properties
t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "reading"),
Boolean::New(env->isolate(), false));
t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "owner"),
Null(env->isolate()));
t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(), "onread"),
Null(env->isolate()));
t->InstanceTemplate()->Set(String::NewFromUtf8(env->isolate(),
"onconnection"),
Null(env->isolate()));


NODE_SET_PROTOTYPE_METHOD(t, "close", HandleWrap::Close);

NODE_SET_PROTOTYPE_METHOD(t, "ref", HandleWrap::Ref);
Expand Down

0 comments on commit 92419f8

Please sign in to comment.