mirror of https://github.com/lukechilds/node.git
Browse Source
This commit attempts to address one of the items in #4641 which is related to src/pipe_wrap.cc and src/tcp_wrap.cc. Currently both pipe_wrap.cc and tcp_wrap.cc contain a class that are almost identical. This commit extracts these parts into a separate class that both can share. PR-URL: https://github.com/nodejs/node/pull/7501 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>v7.x
Daniel Bevenius
9 years ago
committed by
Anna Henningsen
5 changed files with 68 additions and 51 deletions
@ -0,0 +1,22 @@ |
|||
#include "connect_wrap.h" |
|||
|
|||
#include "env.h" |
|||
#include "env-inl.h" |
|||
#include "req-wrap.h" |
|||
#include "req-wrap-inl.h" |
|||
#include "util.h" |
|||
#include "util-inl.h" |
|||
|
|||
namespace node { |
|||
|
|||
using v8::Local; |
|||
using v8::Object; |
|||
|
|||
|
|||
ConnectWrap::ConnectWrap(Environment* env, |
|||
Local<Object> req_wrap_obj, |
|||
AsyncWrap::ProviderType provider) : ReqWrap(env, req_wrap_obj, provider) { |
|||
Wrap(req_wrap_obj, this); |
|||
} |
|||
|
|||
} // namespace node
|
@ -0,0 +1,26 @@ |
|||
#ifndef SRC_CONNECT_WRAP_H_ |
|||
#define SRC_CONNECT_WRAP_H_ |
|||
|
|||
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
|||
|
|||
#include "env.h" |
|||
#include "req-wrap.h" |
|||
#include "async-wrap.h" |
|||
#include "v8.h" |
|||
|
|||
namespace node { |
|||
|
|||
class ConnectWrap : public ReqWrap<uv_connect_t> { |
|||
public: |
|||
ConnectWrap(Environment* env, |
|||
v8::Local<v8::Object> req_wrap_obj, |
|||
AsyncWrap::ProviderType provider); |
|||
|
|||
size_t self_size() const override { return sizeof(*this); } |
|||
}; |
|||
|
|||
} // namespace node
|
|||
|
|||
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|||
|
|||
#endif // SRC_CONNECT_WRAP_H_
|
Loading…
Reference in new issue