From abea481199408103aa5e7b1c3cd3499c6839a31d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 7 Aug 2023 07:16:04 -0700 Subject: [PATCH] Add jsg::Lock taking variant of tryGetHandle (#978) --- src/workerd/jsg/jsg.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/workerd/jsg/jsg.h b/src/workerd/jsg/jsg.h index 9c5f3b77320..72e0fbdcba9 100644 --- a/src/workerd/jsg/jsg.h +++ b/src/workerd/jsg/jsg.h @@ -1076,6 +1076,8 @@ class Ref { return inner->tryGetHandle(isolate); } + kj::Maybe> tryGetHandle(Lock& js); + void attachWrapper(v8::Isolate* isolate, v8::Local object) { // Attach a JavaScript object which implements the JS interface for this C++ object. Normally, // this happens automatically the first time the Ref is passed across the FFI barrier into JS. @@ -2115,6 +2117,11 @@ inline Data Data::addRef(jsg::Lock& js) { return Data(js.v8Isolate, getHandle(js.v8Isolate)); } +template +kj::Maybe> Ref::tryGetHandle(Lock& js) { + return tryGetHandle(js.v8Isolate); +} + template inline V8Ref V8Ref::addRef(jsg::Lock& js) { return js.v8Ref(getHandle(js.v8Isolate));