@@ -6192,9 +6192,8 @@ bool ECDH::IsKeyPairValid() {
6192
6192
// TODO(addaleax): If there is an `AsyncWrap`, it currently has no access to
6193
6193
// this object. This makes proper reporting of memory usage impossible.
6194
6194
struct CryptoJob : public ThreadPoolWork {
6195
- Environment* const env;
6196
6195
std::unique_ptr<AsyncWrap> async_wrap;
6197
- inline explicit CryptoJob (Environment* env) : ThreadPoolWork(env), env(env) {}
6196
+ inline explicit CryptoJob (Environment* env) : ThreadPoolWork(env) {}
6198
6197
inline void AfterThreadPoolWork (int status) final ;
6199
6198
virtual void AfterThreadPoolWork () = 0;
6200
6199
static inline void Run (std::unique_ptr<CryptoJob> job, Local<Value> wrap);
@@ -6205,8 +6204,8 @@ void CryptoJob::AfterThreadPoolWork(int status) {
6205
6204
CHECK (status == 0 || status == UV_ECANCELED);
6206
6205
std::unique_ptr<CryptoJob> job (this );
6207
6206
if (status == UV_ECANCELED) return ;
6208
- HandleScope handle_scope (env->isolate ());
6209
- Context::Scope context_scope (env->context ());
6207
+ HandleScope handle_scope (env () ->isolate ());
6208
+ Context::Scope context_scope (env () ->context ());
6210
6209
CHECK_EQ (false , async_wrap->persistent ().IsWeak ());
6211
6210
AfterThreadPoolWork ();
6212
6211
}
@@ -6247,12 +6246,12 @@ struct RandomBytesJob : public CryptoJob {
6247
6246
6248
6247
inline void AfterThreadPoolWork () override {
6249
6248
Local<Value> arg = ToResult ();
6250
- async_wrap->MakeCallback (env->ondone_string (), 1 , &arg);
6249
+ async_wrap->MakeCallback (env () ->ondone_string (), 1 , &arg);
6251
6250
}
6252
6251
6253
6252
inline Local<Value> ToResult () const {
6254
- if (errors.empty ()) return Undefined (env->isolate ());
6255
- return errors.ToException (env).ToLocalChecked ();
6253
+ if (errors.empty ()) return Undefined (env () ->isolate ());
6254
+ return errors.ToException (env () ).ToLocalChecked ();
6256
6255
}
6257
6256
};
6258
6257
@@ -6304,11 +6303,11 @@ struct PBKDF2Job : public CryptoJob {
6304
6303
6305
6304
inline void AfterThreadPoolWork () override {
6306
6305
Local<Value> arg = ToResult ();
6307
- async_wrap->MakeCallback (env->ondone_string (), 1 , &arg);
6306
+ async_wrap->MakeCallback (env () ->ondone_string (), 1 , &arg);
6308
6307
}
6309
6308
6310
6309
inline Local<Value> ToResult () const {
6311
- return Boolean::New (env->isolate (), success.FromJust ());
6310
+ return Boolean::New (env () ->isolate (), success.FromJust ());
6312
6311
}
6313
6312
6314
6313
inline void Cleanse () {
@@ -6384,12 +6383,12 @@ struct ScryptJob : public CryptoJob {
6384
6383
6385
6384
inline void AfterThreadPoolWork () override {
6386
6385
Local<Value> arg = ToResult ();
6387
- async_wrap->MakeCallback (env->ondone_string (), 1 , &arg);
6386
+ async_wrap->MakeCallback (env () ->ondone_string (), 1 , &arg);
6388
6387
}
6389
6388
6390
6389
inline Local<Value> ToResult () const {
6391
- if (errors.empty ()) return Undefined (env->isolate ());
6392
- return errors.ToException (env).ToLocalChecked ();
6390
+ if (errors.empty ()) return Undefined (env () ->isolate ());
6391
+ return errors.ToException (env () ).ToLocalChecked ();
6393
6392
}
6394
6393
6395
6394
inline void Cleanse () {
@@ -6653,22 +6652,22 @@ class GenerateKeyPairJob : public CryptoJob {
6653
6652
inline void AfterThreadPoolWork () override {
6654
6653
Local<Value> args[3 ];
6655
6654
ToResult (&args[0 ], &args[1 ], &args[2 ]);
6656
- async_wrap->MakeCallback (env->ondone_string (), 3 , args);
6655
+ async_wrap->MakeCallback (env () ->ondone_string (), 3 , args);
6657
6656
}
6658
6657
6659
6658
inline void ToResult (Local<Value>* err,
6660
6659
Local<Value>* pubkey,
6661
6660
Local<Value>* privkey) {
6662
6661
if (pkey_ && EncodeKeys (pubkey, privkey)) {
6663
6662
CHECK (errors_.empty ());
6664
- *err = Undefined (env->isolate ());
6663
+ *err = Undefined (env () ->isolate ());
6665
6664
} else {
6666
6665
if (errors_.empty ())
6667
6666
errors_.Capture ();
6668
6667
CHECK (!errors_.empty ());
6669
- *err = errors_.ToException (env).ToLocalChecked ();
6670
- *pubkey = Undefined (env->isolate ());
6671
- *privkey = Undefined (env->isolate ());
6668
+ *err = errors_.ToException (env () ).ToLocalChecked ();
6669
+ *pubkey = Undefined (env () ->isolate ());
6670
+ *privkey = Undefined (env () ->isolate ());
6672
6671
}
6673
6672
}
6674
6673
@@ -6677,20 +6676,21 @@ class GenerateKeyPairJob : public CryptoJob {
6677
6676
if (public_key_encoding_.output_key_object_ ) {
6678
6677
// Note that this has the downside of containing sensitive data of the
6679
6678
// private key.
6680
- if (!KeyObject::Create (env, kKeyTypePublic , pkey_).ToLocal (pubkey))
6679
+ if (!KeyObject::Create (env () , kKeyTypePublic , pkey_).ToLocal (pubkey))
6681
6680
return false ;
6682
6681
} else {
6683
- if (!WritePublicKey (env, pkey_.get (), public_key_encoding_)
6682
+ if (!WritePublicKey (env () , pkey_.get (), public_key_encoding_)
6684
6683
.ToLocal (pubkey))
6685
6684
return false ;
6686
6685
}
6687
6686
6688
6687
// Now do the same for the private key.
6689
6688
if (private_key_encoding_.output_key_object_ ) {
6690
- if (!KeyObject::Create (env, kKeyTypePrivate , pkey_).ToLocal (privkey))
6689
+ if (!KeyObject::Create (env (), kKeyTypePrivate , pkey_)
6690
+ .ToLocal (privkey))
6691
6691
return false ;
6692
6692
} else {
6693
- if (!WritePrivateKey (env, pkey_.get (), private_key_encoding_)
6693
+ if (!WritePrivateKey (env () , pkey_.get (), private_key_encoding_)
6694
6694
.ToLocal (privkey))
6695
6695
return false ;
6696
6696
}
0 commit comments