From 8cb884102c17ef0530277126fd8da054d329d065 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 1 Jun 2017 14:59:33 -0700 Subject: Tag CFXJSE_HostObject sub-classes. CXFA_FM2JSContext and CXFA_Object both subclass CFXJSE_HostObject. When a CFXJSE_HostObject is obtained from an opaque pointer inside a V8 object internal slot, there is no way to distinguish one from the other. Bug: 728158 Change-Id: Iabc648e8b7226e2819d8795227442c3f6c61a793 Reviewed-on: https://pdfium-review.googlesource.com/6211 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fxjs/fxjse.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'fxjs/fxjse.h') diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h index a29c0893af..8fc514bba3 100644 --- a/fxjs/fxjse.h +++ b/fxjs/fxjse.h @@ -14,10 +14,20 @@ class CFXJSE_Arguments; class CFXJSE_Value; -// C++ object which can be wrapped by CFXJSE_value. +// C++ object which is retrieved from v8 object's slot. class CFXJSE_HostObject { public: virtual ~CFXJSE_HostObject() {} + + // Small layering violation here, but we need to distinguish between the + // two kinds of subclasses. + enum Type { kXFA, kFM2JS }; + Type type() const { return type_; } + + protected: + explicit CFXJSE_HostObject(Type type) { type_ = type; } + + Type type_; }; typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis, -- cgit v1.2.3