Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 36.4k
stream_wrap: add HandleScope's in uv callbacks#1078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -145,6 +145,9 @@ void StreamWrap::OnAlloc(uv_handle_t* handle, | ||
| size_t suggested_size, | ||
| uv_buf_t* buf) { | ||
| StreamWrap* wrap = static_cast<StreamWrap*>(handle->data); | ||
| HandleScope scope(wrap->env()->isolate()); | ||
| Context::Scope context_scope(wrap->env()->context()); | ||
| CHECK_EQ(wrap->stream(), reinterpret_cast<uv_stream_t*>(handle)); | ||
| return static_cast<StreamBase*>(wrap)->OnAlloc(suggested_size, buf); | ||
| @@ -229,6 +232,7 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle, | ||
| const uv_buf_t* buf, | ||
| uv_handle_type pending) { | ||
| StreamWrap* wrap = static_cast<StreamWrap*>(handle->data); | ||
| HandleScope scope(wrap->env()->isolate()); | ||
| // We should not be getting this callback if someone as already called | ||
| // uv_close() on the handle. | ||
| @@ -280,6 +284,7 @@ int StreamWrap::DoShutdown(ShutdownWrap* req_wrap) { | ||
| void StreamWrap::AfterShutdown(uv_shutdown_t* req, int status) { | ||
| ShutdownWrap* req_wrap = ContainerOf(&ShutdownWrap::req_, req); | ||
| HandleScope scope(req_wrap->env()->isolate()); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this have a Context::Scope as well? MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should, thanks! | ||
| req_wrap->Done(status); | ||
| } | ||
| @@ -354,6 +359,8 @@ int StreamWrap::DoWrite(WriteWrap* w, | ||
| void StreamWrap::AfterWrite(uv_write_t* req, int status) { | ||
| WriteWrap* req_wrap = ContainerOf(&WriteWrap::req_, req); | ||
| HandleScope scope(req_wrap->env()->isolate()); | ||
| Context::Scope context_scope(req_wrap->env()->context()); | ||
| req_wrap->Done(status); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this HandleScope do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Captures all handles in this libuv callback?
OnReadCommoncallsOnRead()which might create handles.