diff --git a/src/async-wrap.h b/src/async-wrap.h index cb0c9e211a8923..5db29600bcd180 100644 --- a/src/async-wrap.h +++ b/src/async-wrap.h @@ -17,7 +17,6 @@ namespace node { V(FSREQWRAP) \ V(GETADDRINFOREQWRAP) \ V(GETNAMEINFOREQWRAP) \ - V(HTTPPARSER) \ V(JSSTREAM) \ V(PIPEWRAP) \ V(PIPECONNECTWRAP) \ diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 0b363ca6c310f7..12c6fcff86c145 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -2,8 +2,8 @@ #include "node_buffer.h" #include "node_http_parser.h" -#include "async-wrap.h" -#include "async-wrap-inl.h" +#include "base-object.h" +#include "base-object-inl.h" #include "env.h" #include "env-inl.h" #include "stream_base.h" @@ -147,10 +147,10 @@ struct StringPtr { }; -class Parser : public AsyncWrap { +class Parser : public BaseObject { public: Parser(Environment* env, Local wrap, enum http_parser_type type) - : AsyncWrap(env, wrap, AsyncWrap::PROVIDER_HTTPPARSER), + : BaseObject(env, wrap), current_buffer_len_(0), current_buffer_data_(nullptr) { Wrap(object(), this); @@ -164,11 +164,6 @@ class Parser : public AsyncWrap { } - size_t self_size() const override { - return sizeof(*this); - } - - HTTP_CB(on_message_begin) { num_fields_ = num_values_ = 0; url_.Reset(); @@ -290,10 +285,8 @@ class Parser : public AsyncWrap { argv[A_UPGRADE] = Boolean::New(env()->isolate(), parser_.upgrade); - Environment::AsyncCallbackScope callback_scope(env()); - Local head_response = - MakeCallback(cb.As(), ARRAY_SIZE(argv), argv); + cb.As()->Call(obj, ARRAY_SIZE(argv), argv); if (head_response.IsEmpty()) { got_exception_ = true; @@ -328,7 +321,7 @@ class Parser : public AsyncWrap { Integer::NewFromUnsigned(env()->isolate(), length) }; - Local r = MakeCallback(cb.As(), ARRAY_SIZE(argv), argv); + Local r = cb.As()->Call(obj, ARRAY_SIZE(argv), argv); if (r.IsEmpty()) { got_exception_ = true; @@ -351,9 +344,7 @@ class Parser : public AsyncWrap { if (!cb->IsFunction()) return 0; - Environment::AsyncCallbackScope callback_scope(env()); - - Local r = MakeCallback(cb.As(), 0, nullptr); + Local r = cb.As()->Call(obj, 0, nullptr); if (r.IsEmpty()) { got_exception_ = true; @@ -593,7 +584,7 @@ class Parser : public AsyncWrap { parser->current_buffer_len_ = nread; parser->current_buffer_data_ = buf->base; - parser->MakeCallback(cb.As(), 1, &ret); + cb.As()->Call(obj, 1, &ret); parser->current_buffer_len_ = 0; parser->current_buffer_data_ = nullptr; @@ -680,7 +671,7 @@ class Parser : public AsyncWrap { url_.ToString(env()) }; - Local r = MakeCallback(cb.As(), ARRAY_SIZE(argv), argv); + Local r = cb.As()->Call(obj, ARRAY_SIZE(argv), argv); if (r.IsEmpty()) got_exception_ = true; diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js index 3a2c80d9cbe173..c08c7a43d445e0 100644 --- a/test/parallel/test-async-wrap-check-providers.js +++ b/test/parallel/test-async-wrap-check-providers.js @@ -11,7 +11,6 @@ const tls = require('tls'); const zlib = require('zlib'); const ChildProcess = require('child_process').ChildProcess; const StreamWrap = require('_stream_wrap').StreamWrap; -const HTTPParser = process.binding('http_parser').HTTPParser; const async_wrap = process.binding('async_wrap'); const pkeys = Object.keys(async_wrap.Providers); @@ -107,8 +106,6 @@ zlib.createGzip(); new ChildProcess(); -new HTTPParser(HTTPParser.REQUEST); - process.on('exit', function() { if (keyList.length !== 0) { process._rawDebug('Not all keys have been used:');