diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-11 17:55:17 -0500 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2017-12-18 09:58:02 -0500 |
commit | d36e1b4fed57b34d93e70d3408d753e00b8ed754 (patch) | |
tree | 03e0a12b194453231ad7391ff16b2c7cf3a489f2 /src/stream_wrap.h | |
parent | 68c63a9fa362138bed852714862ac37b85c06adb (diff) | |
download | node-new-d36e1b4fed57b34d93e70d3408d753e00b8ed754.tar.gz |
net,src: refactor writeQueueSize tracking
Currently, writeQueueSize is never used in C++ and barely used
within JS. Instead of constantly updating the value on the JS
object, create a getter that will retrieve the most up-to-date
value from C++.
For the vast majority of cases though, create a new prop on
Socket.prototype[kLastWriteQueueSize] using a Symbol. Use this
to track the current write size, entirely in JS land.
PR-URL: https://github.com/nodejs/node/pull/17650
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/stream_wrap.h')
-rw-r--r-- | src/stream_wrap.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 414bad393f..a695f9a08a 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -55,6 +55,7 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase { uv_buf_t* bufs, size_t count, uv_stream_t* send_handle) override; + bool HasWriteQueue() override; inline uv_stream_t* stream() const { return stream_; @@ -83,15 +84,14 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase { } AsyncWrap* GetAsyncWrap() override; - uint32_t UpdateWriteQueueSize(); static void AddMethods(Environment* env, v8::Local<v8::FunctionTemplate> target, int flags = StreamBase::kFlagNone); private: - static void UpdateWriteQueueSize( - const v8::FunctionCallbackInfo<v8::Value>& args); + static void GetWriteQueueSize( + const v8::FunctionCallbackInfo<v8::Value>& info); static void SetBlocking(const v8::FunctionCallbackInfo<v8::Value>& args); // Callbacks for libuv |