Skip to content

Commit ecf3cd1

Browse files
oleavrhsorbo
andcommitted
iostream: Move to Nan::Persistent
For improved portability, to support latest Electron. Co-authored-by: Håvard Sørbø <[email protected]>
1 parent e247bd5 commit ecf3cd1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/iostream.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#define IOSTREAM_DATA_CONSTRUCTOR "iostream:ctor"
77

8-
using v8::CopyablePersistentTraits;
98
using v8::DEFAULT;
109
using v8::External;
1110
using v8::Function;
@@ -185,12 +184,9 @@ class WriteOperation : public Operation<GIOStream> {
185184
public:
186185
WriteOperation(Isolate* isolate, Local<Value> buffer)
187186
: stream_(NULL),
188-
buffer_(isolate, buffer),
189187
data_(node::Buffer::Data(buffer)),
190188
count_(node::Buffer::Length(buffer)) {
191-
}
192-
193-
~WriteOperation() {
189+
buffer_.Reset(buffer);
194190
}
195191

196192
protected:
@@ -211,7 +207,7 @@ class WriteOperation : public Operation<GIOStream> {
211207

212208
private:
213209
GOutputStream* stream_;
214-
Persistent<Value, CopyablePersistentTraits<Value>> buffer_;
210+
Nan::Persistent<Value, Nan::CopyablePersistentTraits<Value>> buffer_;
215211
const void* data_;
216212
gsize count_;
217213
};

0 commit comments

Comments
 (0)