Skip to content

Commit ef83aa3

Browse files
committed
Add some comments for clarification on ownership
1 parent f41c963 commit ef83aa3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

generate/templates/partials/convert_to_v8.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
{% if ownedBy %}
8383
{% if isAsync %}
8484
{% each ownedBy as owner %}
85+
{%-- If the owner of this object is "this" in an async method, it will be stored in the persistent handle by name. --%}
8586
Nan::Set(owners, Nan::New<v8::Number>(owners->Length()), this->GetFromPersistent("{{= owner =}}")->ToObject());
8687
{% endeach %}
8788
{% else %}
@@ -92,6 +93,7 @@
9293
{% endif %}
9394
{%if isAsync %}
9495
{% elsif ownedByThis %}
96+
{%-- If the owner of this object is "this", it will be retrievable from the info object in a sync method. --%}
9597
Nan::Set(owners, owners->Length(), info.This());
9698
{% endif %}
9799
{% if ownerFn | toBool %}
@@ -137,6 +139,7 @@
137139
{% if ownedBy %}
138140
{% if isAsync %}
139141
{% each ownedBy as owner %}
142+
{%-- If the owner of this object is "this" in an async method, it will be stored in the persistent handle by name. --%}
140143
Nan::Set(owners, Nan::New<v8::Number>(owners->Length()), this->GetFromPersistent("{{= owner =}}")->ToObject());
141144
{% endeach %}
142145
{% else %}
@@ -147,6 +150,7 @@
147150
{% endif %}
148151
{%if isAsync %}
149152
{% elsif ownedByThis %}
153+
{%-- If the owner of this object is "this", it will be retrievable from the info object in a sync method. --%}
150154
Nan::Set(owners, owners->Length(), info.This());
151155
{% endif %}
152156
{% if ownerFn | toBool %}

0 commit comments

Comments
 (0)