diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2016-02-14 06:53:48 +0300 |
---|---|---|
committer | Ali Sheikh <ofrobots@lemonhope.roam.corp.google.com> | 2016-03-04 07:35:20 +0300 |
commit | ebbbc5a790db6900653ad9c697c60861dc518589 (patch) | |
tree | c8b014f3216921da5875f50294893385545360f8 /src/node_buffer.h | |
parent | 34aac23d0b14bd081fc6785873063a147fa5fa65 (diff) |
buffer: replace deprecated SetWeak usage
Old style SetWeak is now deprecated, and weakness now works like
phantom references. This means we no longer have a reference to the
object in the weak callback. We use a kInternalFields style weak
callback which provides us with the contents of 2 internal fields
where we can squirrel away the native buffer pointer.
We can no longer neuter the buffer in the weak callback, but that
should be unnecessary as the object is going to be GC'd during the
current gc cycle.
PR-URL: https://github.com/nodejs/node/pull/5204
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'src/node_buffer.h')
-rw-r--r-- | src/node_buffer.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/node_buffer.h b/src/node_buffer.h index 503cbb16754..2bcf245f392 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -10,6 +10,10 @@ namespace Buffer { static const unsigned int kMaxLength = sizeof(int32_t) == sizeof(intptr_t) ? 0x3fffffff : 0x7fffffff; +// Buffers have two internal fields, the first of which is reserved for use by +// Node. +static const unsigned int kBufferInternalFieldIndex = 0; + NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint); NODE_EXTERN bool HasInstance(v8::Local<v8::Value> val); |