From 47228aceb86744f858ab8bfa98f3f8b62054dfae Mon Sep 17 00:00:00 2001 From: weili Date: Wed, 20 Jul 2016 10:35:31 -0700 Subject: Clean up singleton implementation Move the singleton instances into their namespaces, and use get()/getInstance() for uniform accesses. Review-Url: https://codereview.chromium.org/2154843002 --- fpdfsdk/javascript/JS_GlobalData.h | 41 ++------------------------------------ 1 file changed, 2 insertions(+), 39 deletions(-) (limited to 'fpdfsdk/javascript/JS_GlobalData.h') diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index 8273c0838c..d901ec58b3 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -11,49 +11,14 @@ #include #include "core/fxcrt/include/fx_basic.h" +#include "fpdfsdk/javascript/JS_KeyValue.h" -#define JS_GLOBALDATA_TYPE_NUMBER 0 -#define JS_GLOBALDATA_TYPE_BOOLEAN 1 -#define JS_GLOBALDATA_TYPE_STRING 2 -#define JS_GLOBALDATA_TYPE_OBJECT 3 -#define JS_GLOBALDATA_TYPE_NULL 4 - -class CJS_KeyValue; class CPDFDoc_Environment; -class CJS_GlobalVariableArray { - public: - CJS_GlobalVariableArray(); - virtual ~CJS_GlobalVariableArray(); - - void Add(CJS_KeyValue* p); - int Count() const; - CJS_KeyValue* GetAt(int index) const; - void Copy(const CJS_GlobalVariableArray& array); - - void Empty(); - - private: - CFX_ArrayTemplate m_Array; -}; - -class CJS_KeyValue { - public: - CJS_KeyValue(); - virtual ~CJS_KeyValue(); - - CFX_ByteString sKey; - int nType; // 0:int 1:bool 2:string 3:obj - double dData; - bool bData; - CFX_ByteString sData; - CJS_GlobalVariableArray objData; -}; - class CJS_GlobalData_Element { public: CJS_GlobalData_Element() {} - virtual ~CJS_GlobalData_Element() {} + ~CJS_GlobalData_Element() {} CJS_KeyValue data; FX_BOOL bPersistent; @@ -84,8 +49,6 @@ class CJS_GlobalData { using const_iterator = std::vector>::const_iterator; - static CJS_GlobalData* g_Instance; - CJS_GlobalData(); ~CJS_GlobalData(); -- cgit v1.2.3