| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bbdd93f commit 09b3fae
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -243,7 +243,7 @@ void AsyncWrap::EmitAfter(Environment* env, double async_id) { | |||
| 243 | 243 | class PromiseWrap : public AsyncWrap { | |
| 244 | 244 | public: | |
| 245 | 245 | PromiseWrap(Environment* env, Local<Object> object, bool silent) | |
| 246 | - : AsyncWrap(env, object, PROVIDER_PROMISE, silent) { | ||
| 246 | + : AsyncWrap(env, object, silent) { | ||
| 247 | 247 | MakeWeak(this); | |
| 248 | 248 | } | |
| 249 | 249 | size_t self_size() const override { return sizeof(*this); } | |
@@ -573,8 +573,7 @@ void LoadAsyncWrapperInfo(Environment* env) { | |||
| 573 | 573 | ||
| 574 | 574 | AsyncWrap::AsyncWrap(Environment* env, | |
| 575 | 575 | Local<Object> object, | |
| 576 | - ProviderType provider, | ||
| 577 | - bool silent) | ||
| 576 | + ProviderType provider) | ||
| 578 | 577 | : BaseObject(env, object), | |
| 579 | 578 | provider_type_(provider) { | |
| 580 | 579 | CHECK_NE(provider, PROVIDER_NONE); | |
@@ -583,6 +582,22 @@ AsyncWrap::AsyncWrap(Environment* env, | |||
| 583 | 582 | // Shift provider value over to prevent id collision. | |
| 584 | 583 | persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider); | |
| 585 | 584 | ||
| 585 | + // Use AsyncReset() call to execute the init() callbacks. | ||
| 586 | + AsyncReset(); | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + | ||
| 590 | + // This is specifically used by the PromiseWrap constructor. | ||
| 591 | + AsyncWrap::AsyncWrap(Environment* env, | ||
| 592 | + Local<Object> object, | ||
| 593 | + bool silent) | ||
| 594 | + : BaseObject(env, object), | ||
| 595 | + provider_type_(PROVIDER_PROMISE) { | ||
| 596 | + CHECK_GE(object->InternalFieldCount(), 1); | ||
| 597 | + | ||
| 598 | + // Shift provider value over to prevent id collision. | ||
| 599 | + persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider_type_); | ||
| 600 | + | ||
| 586 | 601 | // Use AsyncReset() call to execute the init() callbacks. | |
| 587 | 602 | AsyncReset(silent); | |
| 588 | 603 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,8 +95,7 @@ class AsyncWrap : public BaseObject { | |||
| 95 | 95 | ||
| 96 | 96 | AsyncWrap(Environment* env, | |
| 97 | 97 | v8::Local<v8::Object> object, | |
| 98 | - ProviderType provider, | ||
| 99 | - bool silent = false); | ||
| 98 | + ProviderType provider); | ||
| 100 | 99 | ||
| 101 | 100 | virtual ~AsyncWrap(); | |
| 102 | 101 | ||
@@ -151,6 +150,10 @@ class AsyncWrap : public BaseObject { | |||
| 151 | 150 | virtual size_t self_size() const = 0; | |
| 152 | 151 | ||
| 153 | 152 | private: | |
| 153 | + friend class PromiseWrap; | ||
| 154 | + | ||
| 155 | + // This is specifically used by the PromiseWrap constructor. | ||
| 156 | + AsyncWrap(Environment* env, v8::Local<v8::Object> promise, bool silent); | ||
| 154 | 157 | inline AsyncWrap(); | |
| 155 | 158 | const ProviderType provider_type_; | |
| 156 | 159 | // Because the values may be Reset(), cannot be made const. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments