| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f490421 commit 054dd28
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -230,7 +230,7 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) { | |||
| 230 | 230 | class PromiseWrap : public AsyncWrap { | |
| 231 | 231 | public: | |
| 232 | 232 | PromiseWrap(Environment* env, Local<Object> object, bool silent) | |
| 233 | - : AsyncWrap(env, object, silent) { | ||
| 233 | + : AsyncWrap(env, object, PROVIDER_PROMISE, -1, silent) { | ||
| 234 | 234 | MakeWeak(this); | |
| 235 | 235 | } | |
| 236 | 236 | size_t self_size() const override { return sizeof(*this); } | |
@@ -602,32 +602,23 @@ AsyncWrap::AsyncWrap(Environment* env, | |||
| 602 | 602 | Local<Object> object, | |
| 603 | 603 | ProviderType provider, | |
| 604 | 604 | double execution_async_id) | |
| 605 | - : BaseObject(env, object), | ||
| 606 | - provider_type_(provider) { | ||
| 607 | - CHECK_NE(provider, PROVIDER_NONE); | ||
| 608 | - CHECK_GE(object->InternalFieldCount(), 1); | ||
| 605 | + : AsyncWrap(env, object, provider, execution_async_id, false) {} | ||
| 609 | 606 | ||
| 610 | - // Shift provider value over to prevent id collision. | ||
| 611 | - persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider); | ||
| 612 | - | ||
| 613 | - // Use AsyncReset() call to execute the init() callbacks. | ||
| 614 | - AsyncReset(execution_async_id); | ||
| 615 | - } | ||
| 616 | - | ||
| 617 | - | ||
| 618 | - // This is specifically used by the PromiseWrap constructor. | ||
| 619 | 607 | AsyncWrap::AsyncWrap(Environment* env, | |
| 620 | 608 | Local<Object> object, | |
| 609 | + ProviderType provider, | ||
| 610 | + double execution_async_id, | ||
| 621 | 611 | bool silent) | |
| 622 | 612 | : BaseObject(env, object), | |
| 623 | - provider_type_(PROVIDER_PROMISE) { | ||
| 613 | + provider_type_(provider) { | ||
| 614 | + CHECK_NE(provider, PROVIDER_NONE); | ||
| 624 | 615 | CHECK_GE(object->InternalFieldCount(), 1); | |
| 625 | 616 | ||
| 626 | 617 | // Shift provider value over to prevent id collision. | |
| 627 | 618 | persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider_type_); | |
| 628 | 619 | ||
| 629 | 620 | // Use AsyncReset() call to execute the init() callbacks. | |
| 630 | - AsyncReset(-1, silent); | ||
| 621 | + AsyncReset(execution_async_id, silent); | ||
| 631 | 622 | } | |
| 632 | 623 | ||
| 633 | 624 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -172,8 +172,11 @@ class AsyncWrap : public BaseObject { | |||
| 172 | 172 | private: | |
| 173 | 173 | friend class PromiseWrap; | |
| 174 | 174 | ||
| 175 | - // This is specifically used by the PromiseWrap constructor. | ||
| 176 | - AsyncWrap(Environment* env, v8::Local<v8::Object> promise, bool silent); | ||
| 175 | + AsyncWrap(Environment* env, | ||
| 176 | + v8::Local<v8::Object> promise, | ||
| 177 | + ProviderType provider, | ||
| 178 | + double execution_async_id, | ||
| 179 | + bool silent); | ||
| 177 | 180 | inline AsyncWrap(); | |
| 178 | 181 | const ProviderType provider_type_; | |
| 179 | 182 | // Because the values may be Reset(), cannot be made const. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments