GeezerVison is showing github.com — async_wrap: new instances get uid · nodejs/node@eccbec9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/async-wrap-inl.h +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,7 +17,8 @@ inline AsyncWrap::AsyncWrap(Environment* env, | 17 | 17 | v8::Local<v8::Object> object, | 18 | 18 | ProviderType provider, | 19 | 19 | AsyncWrap* parent) | 20 | | - : BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1) { | | 20 | + : BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1), | | 21 | + uid_(env->get_async_wrap_uid()) { | 21 | 22 | CHECK_NE(provider, PROVIDER_NONE); | 22 | 23 | CHECK_GE(object->InternalFieldCount(), 1); | 23 | 24 |
| @@ -66,6 +67,11 @@ inline AsyncWrap::ProviderType AsyncWrap::provider_type() const { | 66 | 67 | } | 67 | 68 |
| 68 | 69 |
| | 70 | +inline int64_t AsyncWrap::get_uid() const { | | 71 | + return uid_; | | 72 | +} | | 73 | + | | 74 | + | 69 | 75 | inline v8::Local<v8::Value> AsyncWrap::MakeCallback( | 70 | 76 | const v8::Local<v8::String> symbol, | 71 | 77 | int argc, | |
Collapse file Copy file name to clipboardExpand all lines: src/async-wrap.h +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,8 @@ class AsyncWrap : public BaseObject { | 55 | 55 |
| 56 | 56 | inline ProviderType provider_type() const; | 57 | 57 |
| | 58 | + inline int64_t get_uid() const; | | 59 | + | 58 | 60 | // Only call these within a valid HandleScope. | 59 | 61 | v8::Local<v8::Value> MakeCallback(const v8::Local<v8::Function> cb, | 60 | 62 | int argc, | @@ -76,6 +78,7 @@ class AsyncWrap : public BaseObject { | 76 | 78 | // expected the context object will receive a _asyncQueue object property | 77 | 79 | // that will be used to call pre/post in MakeCallback. | 78 | 80 | uint32_t bits_; | | 81 | + const int64_t uid_; | 79 | 82 | }; | 80 | 83 |
| 81 | 84 | void LoadAsyncWrapperInfo(Environment* env); | |
Collapse file Copy file name to clipboardExpand all lines: src/env-inl.h +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -210,6 +210,7 @@ inline Environment::Environment(v8::Local<v8::Context> context, | 210 | 210 | using_domains_(false), | 211 | 211 | printed_error_(false), | 212 | 212 | trace_sync_io_(false), | | 213 | + async_wrap_uid_(0), | 213 | 214 | debugger_agent_(this), | 214 | 215 | http_parser_buffer_(nullptr), | 215 | 216 | context_(context->GetIsolate(), context) { | @@ -359,6 +360,10 @@ inline void Environment::set_trace_sync_io(bool value) { | 359 | 360 | trace_sync_io_ = value; | 360 | 361 | } | 361 | 362 |
| | 363 | +inline int64_t Environment::get_async_wrap_uid() { | | 364 | + return ++async_wrap_uid_; | | 365 | +} | | 366 | + | 362 | 367 | inline uint32_t* Environment::heap_statistics_buffer() const { | 363 | 368 | CHECK_NE(heap_statistics_buffer_, nullptr); | 364 | 369 | return heap_statistics_buffer_; | |
Collapse file Copy file name to clipboardExpand all lines: src/env.h +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -446,6 +446,8 @@ class Environment { | 446 | 446 | void PrintSyncTrace() const; | 447 | 447 | inline void set_trace_sync_io(bool value); | 448 | 448 |
| | 449 | + inline int64_t get_async_wrap_uid(); | | 450 | + | 449 | 451 | bool KickNextTick(); | 450 | 452 |
| 451 | 453 | inline uint32_t* heap_statistics_buffer() const; | @@ -541,6 +543,7 @@ class Environment { | 541 | 543 | bool using_domains_; | 542 | 544 | bool printed_error_; | 543 | 545 | bool trace_sync_io_; | | 546 | + int64_t async_wrap_uid_; | 544 | 547 | debugger::Agent debugger_agent_; | 545 | 548 |
| 546 | 549 | HandleWrapQueue handle_wrap_queue_; | |
|