summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_GlobalData.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-20 10:35:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-20 10:35:31 -0700
commit47228aceb86744f858ab8bfa98f3f8b62054dfae (patch)
treed5d8abbc5eaeb23b291cf604bf33c77cf648b0bb /fpdfsdk/javascript/JS_GlobalData.h
parent31f8740fe51ceca8e973a2efe40d4d440d7a5cb7 (diff)
downloadpdfium-47228aceb86744f858ab8bfa98f3f8b62054dfae.tar.xz
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
Diffstat (limited to 'fpdfsdk/javascript/JS_GlobalData.h')
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h41
1 files changed, 2 insertions, 39 deletions
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 <vector>
#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<CJS_KeyValue*> 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<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator;
- static CJS_GlobalData* g_Instance;
-
CJS_GlobalData();
~CJS_GlobalData();