forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: unifying PipeConnectWrap and TCPConnectWrap
This commit attempts to address one of the items in nodejs#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: nodejs#7501 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Loading branch information
Showing
5 changed files
with
68 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters