Convert CFXJSE_FormCalcContext::m_pDocument to WeakPersistent<>.
This is a safer way to hold an unowned reference to a GCed object
than UnownedPtr<>, though it doesn't seem like there's currently
a way to violate the lifetime constraints.
Change-Id: Id0989d0731e716eb0e5c5ff15bc2ddc71aac309f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99491
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cfxjse_formcalc_context.h b/fxjs/xfa/cfxjse_formcalc_context.h
index 229832e..4517f0c 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.h
+++ b/fxjs/xfa/cfxjse_formcalc_context.h
@@ -11,10 +11,10 @@
#include <functional>
-#include "core/fxcrt/unowned_ptr.h"
#include "core/fxcrt/widetext_buffer.h"
#include "fxjs/xfa/fxjse.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
+#include "v8/include/cppgc/persistent.h"
#include "v8/include/v8-forward.h"
#include "v8/include/v8-persistent-handle.h"
@@ -307,7 +307,7 @@
UnownedPtr<v8::Isolate> const m_pIsolate;
v8::Global<v8::Value> m_Value;
- UnownedPtr<CXFA_Document> const m_pDocument;
+ cppgc::WeakPersistent<CXFA_Document> const m_pDocument;
};
#endif // FXJS_XFA_CFXJSE_FORMCALC_CONTEXT_H_