GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — async_wrap: new instances get uid · nodejs/node@eccbec9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • async-wrap-inl.h
    • async-wrap.h
    • env-inl.h
    • env.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/async-wrap-inl.h‎

Copy file name to clipboardExpand all lines: src/async-wrap-inl.h
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ inline AsyncWrap::AsyncWrap(Environment* env,
1717
v8::Local<v8::Object> object,
1818
ProviderType provider,
1919
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()) {
2122
CHECK_NE(provider, PROVIDER_NONE);
2223
CHECK_GE(object->InternalFieldCount(), 1);
2324

@@ -66,6 +67,11 @@ inline AsyncWrap::ProviderType AsyncWrap::provider_type() const {
6667
}
6768

6869

70+
inline int64_t AsyncWrap::get_uid() const {
71+
return uid_;
72+
}
73+
74+
6975
inline v8::Local<v8::Value> AsyncWrap::MakeCallback(
7076
const v8::Local<v8::String> symbol,
7177
int argc,
Collapse file

‎src/async-wrap.h‎

Copy file name to clipboardExpand all lines: src/async-wrap.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class AsyncWrap : public BaseObject {
5555

5656
inline ProviderType provider_type() const;
5757

58+
inline int64_t get_uid() const;
59+
5860
// Only call these within a valid HandleScope.
5961
v8::Local<v8::Value> MakeCallback(const v8::Local<v8::Function> cb,
6062
int argc,
@@ -76,6 +78,7 @@ class AsyncWrap : public BaseObject {
7678
// expected the context object will receive a _asyncQueue object property
7779
// that will be used to call pre/post in MakeCallback.
7880
uint32_t bits_;
81+
const int64_t uid_;
7982
};
8083

8184
void LoadAsyncWrapperInfo(Environment* env);
Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ inline Environment::Environment(v8::Local<v8::Context> context,
210210
using_domains_(false),
211211
printed_error_(false),
212212
trace_sync_io_(false),
213+
async_wrap_uid_(0),
213214
debugger_agent_(this),
214215
http_parser_buffer_(nullptr),
215216
context_(context->GetIsolate(), context) {
@@ -359,6 +360,10 @@ inline void Environment::set_trace_sync_io(bool value) {
359360
trace_sync_io_ = value;
360361
}
361362

363+
inline int64_t Environment::get_async_wrap_uid() {
364+
return ++async_wrap_uid_;
365+
}
366+
362367
inline uint32_t* Environment::heap_statistics_buffer() const {
363368
CHECK_NE(heap_statistics_buffer_, nullptr);
364369
return heap_statistics_buffer_;
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ class Environment {
446446
void PrintSyncTrace() const;
447447
inline void set_trace_sync_io(bool value);
448448

449+
inline int64_t get_async_wrap_uid();
450+
449451
bool KickNextTick();
450452

451453
inline uint32_t* heap_statistics_buffer() const;
@@ -541,6 +543,7 @@ class Environment {
541543
bool using_domains_;
542544
bool printed_error_;
543545
bool trace_sync_io_;
546+
int64_t async_wrap_uid_;
544547
debugger::Agent debugger_agent_;
545548

546549
HandleWrapQueue handle_wrap_queue_;

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.