| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 09b3fae commit 9da8346
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -451,7 +451,8 @@ void AsyncWrap::ClearAsyncIdStack(const FunctionCallbackInfo<Value>& args) { | |||
| 451 | 451 | void AsyncWrap::AsyncReset(const FunctionCallbackInfo<Value>& args) { | |
| 452 | 452 | AsyncWrap* wrap; | |
| 453 | 453 | ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); | |
| 454 | - wrap->AsyncReset(); | ||
| 454 | + double execution_async_id = args[0]->IsNumber() ? args[0]->NumberValue() : -1; | ||
| 455 | + wrap->AsyncReset(execution_async_id); | ||
| 455 | 456 | } | |
| 456 | 457 | ||
| 457 | 458 | ||
@@ -573,7 +574,8 @@ void LoadAsyncWrapperInfo(Environment* env) { | |||
| 573 | 574 | ||
| 574 | 575 | AsyncWrap::AsyncWrap(Environment* env, | |
| 575 | 576 | Local<Object> object, | |
| 576 | - ProviderType provider) | ||
| 577 | + ProviderType provider, | ||
| 578 | + double execution_async_id) | ||
| 577 | 579 | : BaseObject(env, object), | |
| 578 | 580 | provider_type_(provider) { | |
| 579 | 581 | CHECK_NE(provider, PROVIDER_NONE); | |
@@ -583,7 +585,7 @@ AsyncWrap::AsyncWrap(Environment* env, | |||
| 583 | 585 | persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider); | |
| 584 | 586 | ||
| 585 | 587 | // Use AsyncReset() call to execute the init() callbacks. | |
| 586 | - AsyncReset(); | ||
| 588 | + AsyncReset(execution_async_id); | ||
| 587 | 589 | } | |
| 588 | 590 | ||
| 589 | 591 | ||
@@ -599,7 +601,7 @@ AsyncWrap::AsyncWrap(Environment* env, | |||
| 599 | 601 | persistent().SetWrapperClassId(NODE_ASYNC_ID_OFFSET + provider_type_); | |
| 600 | 602 | ||
| 601 | 603 | // Use AsyncReset() call to execute the init() callbacks. | |
| 602 | - AsyncReset(silent); | ||
| 604 | + AsyncReset(-1, silent); | ||
| 603 | 605 | } | |
| 604 | 606 | ||
| 605 | 607 | ||
@@ -611,8 +613,9 @@ AsyncWrap::~AsyncWrap() { | |||
| 611 | 613 | // Generalized call for both the constructor and for handles that are pooled | |
| 612 | 614 | // and reused over their lifetime. This way a new uid can be assigned when | |
| 613 | 615 | // the resource is pulled out of the pool and put back into use. | |
| 614 | - void AsyncWrap::AsyncReset(bool silent) { | ||
| 615 | - async_id_ = env()->new_async_id(); | ||
| 616 | + void AsyncWrap::AsyncReset(double execution_async_id, bool silent) { | ||
| 617 | + async_id_ = | ||
| 618 | + execution_async_id == -1 ? env()->new_async_id() : execution_async_id; | ||
| 616 | 619 | trigger_async_id_ = env()->get_init_trigger_async_id(); | |
| 617 | 620 | ||
| 618 | 621 | if (silent) return; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,7 +95,8 @@ class AsyncWrap : public BaseObject { | |||
| 95 | 95 | ||
| 96 | 96 | AsyncWrap(Environment* env, | |
| 97 | 97 | v8::Local<v8::Object> object, | |
| 98 | - ProviderType provider); | ||
| 98 | + ProviderType provider, | ||
| 99 | + double execution_async_id = -1); | ||
| 99 | 100 | ||
| 100 | 101 | virtual ~AsyncWrap(); | |
| 101 | 102 | ||
@@ -133,7 +134,7 @@ class AsyncWrap : public BaseObject { | |||
| 133 | 134 | ||
| 134 | 135 | inline double get_trigger_async_id() const; | |
| 135 | 136 | ||
| 136 | - void AsyncReset(bool silent = false); | ||
| 137 | + void AsyncReset(double execution_async_id = -1, bool silent = false); | ||
| 137 | 138 | ||
| 138 | 139 | // Only call these within a valid HandleScope. | |
| 139 | 140 | v8::MaybeLocal<v8::Value> MakeCallback(const v8::Local<v8::Function> cb, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments