2
2
#include " node_buffer.h"
3
3
#include " node_http_parser.h"
4
4
5
- #include " async-wrap .h"
6
- #include " async-wrap -inl.h"
5
+ #include " base-object .h"
6
+ #include " base-object -inl.h"
7
7
#include " env.h"
8
8
#include " env-inl.h"
9
9
#include " stream_base.h"
@@ -147,10 +147,10 @@ struct StringPtr {
147
147
};
148
148
149
149
150
- class Parser : public AsyncWrap {
150
+ class Parser : public BaseObject {
151
151
public:
152
152
Parser (Environment* env, Local<Object> wrap, enum http_parser_type type)
153
- : AsyncWrap (env, wrap, AsyncWrap::PROVIDER_HTTPPARSER ),
153
+ : BaseObject (env, wrap),
154
154
current_buffer_len_ (0 ),
155
155
current_buffer_data_(nullptr ) {
156
156
Wrap (object (), this );
@@ -164,11 +164,6 @@ class Parser : public AsyncWrap {
164
164
}
165
165
166
166
167
- size_t self_size () const override {
168
- return sizeof (*this );
169
- }
170
-
171
-
172
167
HTTP_CB (on_message_begin) {
173
168
num_fields_ = num_values_ = 0 ;
174
169
url_.Reset ();
@@ -290,10 +285,8 @@ class Parser : public AsyncWrap {
290
285
291
286
argv[A_UPGRADE] = Boolean::New (env ()->isolate (), parser_.upgrade );
292
287
293
- Environment::AsyncCallbackScope callback_scope (env ());
294
-
295
288
Local<Value> head_response =
296
- MakeCallback ( cb.As <Function>(), ARRAY_SIZE (argv), argv);
289
+ cb.As <Function>()-> Call (obj , ARRAY_SIZE (argv), argv);
297
290
298
291
if (head_response.IsEmpty ()) {
299
292
got_exception_ = true ;
@@ -328,7 +321,7 @@ class Parser : public AsyncWrap {
328
321
Integer::NewFromUnsigned (env ()->isolate (), length)
329
322
};
330
323
331
- Local<Value> r = MakeCallback ( cb.As <Function>(), ARRAY_SIZE (argv), argv);
324
+ Local<Value> r = cb.As <Function>()-> Call (obj , ARRAY_SIZE (argv), argv);
332
325
333
326
if (r.IsEmpty ()) {
334
327
got_exception_ = true ;
@@ -351,9 +344,7 @@ class Parser : public AsyncWrap {
351
344
if (!cb->IsFunction ())
352
345
return 0 ;
353
346
354
- Environment::AsyncCallbackScope callback_scope (env ());
355
-
356
- Local<Value> r = MakeCallback (cb.As <Function>(), 0 , nullptr );
347
+ Local<Value> r = cb.As <Function>()->Call (obj, 0 , nullptr );
357
348
358
349
if (r.IsEmpty ()) {
359
350
got_exception_ = true ;
@@ -593,7 +584,7 @@ class Parser : public AsyncWrap {
593
584
parser->current_buffer_len_ = nread;
594
585
parser->current_buffer_data_ = buf->base ;
595
586
596
- parser-> MakeCallback ( cb.As <Function>(), 1 , &ret);
587
+ cb.As <Function>()-> Call (obj , 1 , &ret);
597
588
598
589
parser->current_buffer_len_ = 0 ;
599
590
parser->current_buffer_data_ = nullptr ;
@@ -680,7 +671,7 @@ class Parser : public AsyncWrap {
680
671
url_.ToString (env ())
681
672
};
682
673
683
- Local<Value> r = MakeCallback ( cb.As <Function>(), ARRAY_SIZE (argv), argv);
674
+ Local<Value> r = cb.As <Function>()-> Call (obj , ARRAY_SIZE (argv), argv);
684
675
685
676
if (r.IsEmpty ())
686
677
got_exception_ = true ;
0 commit comments