@@ -55,7 +55,6 @@ class FSEventWrap: public HandleWrap {
55
55
Local<Context> context);
56
56
static void New (const FunctionCallbackInfo<Value>& args);
57
57
static void Start (const FunctionCallbackInfo<Value>& args);
58
- static void Close (const FunctionCallbackInfo<Value>& args);
59
58
static void GetInitialized (const FunctionCallbackInfo<Value>& args);
60
59
size_t self_size () const override { return sizeof (*this ); }
61
60
@@ -69,7 +68,6 @@ class FSEventWrap: public HandleWrap {
69
68
int status);
70
69
71
70
uv_fs_event_t handle_;
72
- bool initialized_ = false ;
73
71
enum encoding encoding_ = kDefaultEncoding ;
74
72
};
75
73
@@ -89,7 +87,7 @@ FSEventWrap::~FSEventWrap() {
89
87
void FSEventWrap::GetInitialized (const FunctionCallbackInfo<Value>& args) {
90
88
FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This ());
91
89
CHECK_NOT_NULL (wrap);
92
- args.GetReturnValue ().Set (wrap->initialized_ );
90
+ args.GetReturnValue ().Set (! wrap->IsHandleClosing () );
93
91
}
94
92
95
93
void FSEventWrap::Initialize (Local<Object> target,
@@ -134,7 +132,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
134
132
135
133
FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This ());
136
134
CHECK_NOT_NULL (wrap);
137
- CHECK (! wrap->initialized_ );
135
+ CHECK (wrap->IsHandleClosing ()); // Check that Start() has not been called.
138
136
139
137
const int argc = args.Length ();
140
138
CHECK_GE (argc, 4 );
@@ -155,7 +153,6 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
155
153
156
154
err = uv_fs_event_start (&wrap->handle_ , OnEvent, *path, flags);
157
155
wrap->MarkAsInitialized ();
158
- wrap->initialized_ = true ;
159
156
160
157
if (err != 0 ) {
161
158
FSEventWrap::Close (args);
@@ -230,16 +227,6 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
230
227
wrap->MakeCallback (env->onchange_string (), arraysize (argv), argv);
231
228
}
232
229
233
-
234
- void FSEventWrap::Close (const FunctionCallbackInfo<Value>& args) {
235
- FSEventWrap* wrap = Unwrap<FSEventWrap>(args.Holder ());
236
- CHECK_NOT_NULL (wrap);
237
- CHECK (wrap->initialized_ );
238
-
239
- wrap->initialized_ = false ;
240
- HandleWrap::Close (args);
241
- }
242
-
243
230
} // anonymous namespace
244
231
} // namespace node
245
232
0 commit comments