diff options
Diffstat (limited to 'fpdfsdk/include/javascript')
-rw-r--r-- | fpdfsdk/include/javascript/IJavaScript.h | 17 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/JS_GlobalData.h | 11 |
2 files changed, 13 insertions, 15 deletions
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index 3da2c1a002..d85fc6f109 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -11,10 +11,11 @@ #include "../../../core/include/fxcrt/fx_system.h" #include "../../../xfa/include/fxjse/fxjse.h" -class CPDF_Bookmark; -class CPDF_FormField; +class CPDFDoc_Environment; class CPDFSDK_Annot; class CPDFSDK_Document; +class CPDF_Bookmark; +class CPDF_FormField; class IFXJS_Context { public: @@ -150,27 +151,19 @@ class IFXJS_Runtime { virtual ~IFXJS_Runtime() {} }; -class CPDFDoc_Environment; -class CJS_GlobalData; - class CJS_RuntimeFactory { public: - CJS_RuntimeFactory() - : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {} + CJS_RuntimeFactory() : m_bInit(FALSE), m_nRef(0) {} ~CJS_RuntimeFactory(); + IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); void DeleteJSRuntime(IFXJS_Runtime* pRuntime); void AddRef(); void Release(); - CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp); - void ReleaseGlobalData(); - private: FX_BOOL m_bInit; int m_nRef; - CJS_GlobalData* m_pGlobalData; - int32_t m_nGlobalDataCount; }; #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h index 46b94a4dda..644e0d80fc 100644 --- a/fpdfsdk/include/javascript/JS_GlobalData.h +++ b/fpdfsdk/include/javascript/JS_GlobalData.h @@ -58,10 +58,9 @@ class CJS_GlobalData_Element { class CJS_GlobalData { public: - CJS_GlobalData(CPDFDoc_Environment* pApp); - virtual ~CJS_GlobalData(); + static CJS_GlobalData* GetRetainedInstance(CPDFDoc_Environment* pApp); + void Release(); - public: void SetGlobalVariableNumber(const FX_CHAR* propname, double dData); void SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData); void SetGlobalVariableString(const FX_CHAR* propname, @@ -78,6 +77,11 @@ class CJS_GlobalData { CJS_GlobalData_Element* GetAt(int index) const; private: + static CJS_GlobalData* g_Instance; + + CJS_GlobalData(CPDFDoc_Environment* pApp); + ~CJS_GlobalData(); + void LoadGlobalPersistentVariables(); void SaveGlobalPersisitentVariables(); @@ -95,6 +99,7 @@ class CJS_GlobalData { CFX_BinaryBuf& sData); private: + size_t m_RefCount; CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData; CFX_WideString m_sFilePath; CPDFDoc_Environment* m_pApp; |