summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-25 14:38:06 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-25 14:38:06 -0800
commit57e4c86145a247915c59ae5130cfc3ef9b36aa4c (patch)
treef755d47499ed2bec6449e9f7d461ae76a5096ca9
parent4351ac28111b7c74c397fee606260ced4de228b8 (diff)
downloadpdfium-57e4c86145a247915c59ae5130cfc3ef9b36aa4c.tar.xz
Kill off unused IFXJS interface methods.
Re-work of original CL at: https://codereview.chromium.org/933043002/ Much of the IFXJS interface appears completely unused, so Kill off unused IFXJS interface methods. The code itself appears incomplete against all of the objects present in the paths that actually do register objects with JS. R=thestig@chromium.org Review URL: https://codereview.chromium.org/954923004
-rw-r--r--fpdfsdk/include/javascript/IJavaScript.h11
-rw-r--r--fpdfsdk/include/javascript/JS_Define.h42
-rw-r--r--fpdfsdk/include/javascript/JS_Runtime.h9
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp143
4 files changed, 1 insertions, 204 deletions
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h
index 9ae0329e30..a05d4436e0 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -74,16 +74,7 @@ public:
virtual IFXJS_Context* GetCurrentContext() = 0;
virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
- virtual CPDFSDK_Document* GetReaderDocument() = 0;
-
- virtual void GetObjectNames(CFX_WideStringArray& array) = 0;
- virtual void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
- virtual void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
- virtual void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array) = 0;
-
- virtual void Exit() = 0;
- virtual void Enter() = 0;
- virtual FX_BOOL IsEntered() = 0;
+ virtual CPDFSDK_Document* GetReaderDocument() = 0;
protected:
~IFXJS_Runtime() { }
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index 04833bb57a..4246e01964 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -176,9 +176,6 @@ void JSMethod(const char* method_name_string,
static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
static JSBool JSDestructor(JSFXObject obj);\
static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
- static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
- static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
static JSConstSpec JS_Class_Consts[];\
static JSPropertySpec JS_Class_Properties[];\
static JSMethodSpec JS_Class_Methods[];\
@@ -220,21 +217,6 @@ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
return nObjDefnID;\
}\
return -1;\
-}\
-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
-{\
- pConsts = JS_Class_Consts;\
- nSize = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1;\
-}\
-void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
-{\
- pProperties = JS_Class_Properties;\
- nSize = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1;\
-}\
-void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
-{\
- pMethods = JS_Class_Methods;\
- nSize = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1;\
}
#define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
@@ -243,7 +225,6 @@ void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
#define DECLARE_JS_CLASS_CONST() \
static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
static JSConstSpec JS_Class_Consts[];\
static const wchar_t* m_pClassName
@@ -268,11 +249,6 @@ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
return nObjDefnID;\
}\
return -1;\
-}\
-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
-{\
- pConsts = JS_Class_Consts;\
- nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
}
/* ===================================== SPECIAL JS CLASS =============================================== */
@@ -364,9 +340,6 @@ void JSSpecialPropDel(const char* class_name,
#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
static JSBool JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\
static JSBool JSDestructor(JSFXObject obj);\
- static void GetConsts(JSConstSpec*& pConsts, int& nSize);\
- static void GetProperties(JSPropertySpec*& pProperties, int& nSize);\
- static void GetMethods(JSMethodSpec*& pMethods, int& nSize);\
static JSConstSpec JS_Class_Consts[];\
static JSPropertySpec JS_Class_Properties[];\
static JSMethodSpec JS_Class_Methods[];\
@@ -431,21 +404,6 @@ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
}\
\
return -1;\
-}\
-void js_class_name::GetConsts(JSConstSpec*& pConsts, int& nSize)\
-{\
- pConsts = JS_Class_Consts;\
- nSize = sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1;\
-}\
-void js_class_name::GetProperties(JSPropertySpec*& pProperties, int& nSize)\
-{\
- pProperties = JS_Class_Properties;\
- nSize = sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1;\
-}\
-void js_class_name::GetMethods(JSMethodSpec*& pMethods, int& nSize)\
-{\
- pMethods = JS_Class_Methods;\
- nSize = sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1;\
}
/* ======================================== GLOBAL METHODS ============================================ */
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 0a195f132c..0be8fb4b67 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -28,15 +28,6 @@ public:
virtual void SetReaderDocument(CPDFSDK_Document *pReaderDoc);
virtual CPDFSDK_Document * GetReaderDocument(){return m_pDocument;}
- virtual void GetObjectNames(CFX_WideStringArray& array);
- virtual void GetObjectConsts(const CFX_WideString& swObjName, CFX_WideStringArray& array);
- virtual void GetObjectProps(const CFX_WideString& swObjName, CFX_WideStringArray& array);
- virtual void GetObjectMethods(const CFX_WideString& swObjName, CFX_WideStringArray& array);
-
- virtual void Exit();
- virtual void Enter();
- virtual FX_BOOL IsEntered();
-
CPDFDoc_Environment * GetReaderApp(){return m_pApp;}
FX_BOOL InitJSObjects();
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 30d1cc3165..4ff3c0bc98 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -324,146 +324,3 @@ CFX_WideString ChangeObjName(const CFX_WideString& str)
sRet.Replace(L"_", L".");
return sRet;
}
-
-void CJS_Runtime::GetObjectNames(CFX_WideStringArray& array)
-{
- array.RemoveAll();
-
- array.Add(CJS_Border::m_pClassName);
- array.Add(CJS_Display::m_pClassName);
- array.Add(CJS_Font::m_pClassName);
- array.Add(CJS_Highlight::m_pClassName);
- array.Add(CJS_Position::m_pClassName);
- array.Add(CJS_ScaleHow::m_pClassName);
- array.Add(CJS_ScaleWhen::m_pClassName);
- array.Add(CJS_Style::m_pClassName);
- array.Add(CJS_Zoomtype::m_pClassName);
-
- array.Add(CJS_App::m_pClassName);
- array.Add(L"this");
- array.Add(CJS_Event::m_pClassName);
-
- array.Add(CJS_Global::m_pClassName);
- array.Add(CJS_Util::m_pClassName);
-}
-
-void CJS_Runtime::GetObjectConsts(const CFX_WideString& sObjName, CFX_WideStringArray& array)
-{
- JSConstSpec* pConsts = NULL;
- int nSize = 0;
-
- if (sObjName == CJS_Border::m_pClassName)
- CJS_Border::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Display::m_pClassName)
- CJS_Display::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Font::m_pClassName)
- CJS_Font::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Highlight::m_pClassName)
- CJS_Highlight::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Position::m_pClassName)
- CJS_Position::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_ScaleHow::m_pClassName)
- CJS_ScaleHow::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_ScaleWhen::m_pClassName)
- CJS_ScaleWhen::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Style::m_pClassName)
- CJS_Style::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Zoomtype::m_pClassName)
- CJS_Zoomtype::GetConsts(pConsts, nSize);
-
- else if (sObjName == CJS_App::m_pClassName)
- CJS_App::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Color::m_pClassName)
- CJS_Color::GetConsts(pConsts, nSize);
-
- else if (sObjName == L"this")
- {
- if (GetReaderDocument())
- CJS_Document::GetConsts(pConsts, nSize);
- else
- CJS_App::GetConsts(pConsts, nSize);
- }
-
- if (sObjName == CJS_Event::m_pClassName)
- CJS_Event::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Field::m_pClassName)
- CJS_Field::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Global::m_pClassName)
- CJS_Global::GetConsts(pConsts, nSize);
- else if (sObjName == CJS_Util::m_pClassName)
- CJS_Util::GetConsts(pConsts, nSize);
-
- for (int i=0; i<nSize; i++)
- array.Add(pConsts[i].pName);
-}
-
-void CJS_Runtime::GetObjectProps(const CFX_WideString& sObjName, CFX_WideStringArray& array)
-{
- JSPropertySpec* pProperties = NULL;
- int nSize = 0;
-
- if (sObjName == CJS_App::m_pClassName)
- CJS_App::GetProperties(pProperties, nSize);
- else if (sObjName == CJS_Color::m_pClassName)
- CJS_Color::GetProperties(pProperties, nSize);
- else if (sObjName == L"this")
- {
- if (GetReaderDocument())
- CJS_Document::GetProperties(pProperties, nSize);
- else
- CJS_App::GetProperties(pProperties, nSize);
- }
- else if (sObjName == CJS_Event::m_pClassName)
- CJS_Event::GetProperties(pProperties, nSize);
- else if (sObjName == CJS_Field::m_pClassName)
- CJS_Field::GetProperties(pProperties, nSize);
- else if (sObjName == CJS_Global::m_pClassName)
- CJS_Global::GetProperties(pProperties, nSize);
- else if (sObjName == CJS_Util::m_pClassName)
- CJS_Util::GetProperties(pProperties, nSize);
-
- for (int i=0; i<nSize; i++)
- array.Add(pProperties[i].pName);
-}
-
-void CJS_Runtime::GetObjectMethods(const CFX_WideString& sObjName, CFX_WideStringArray& array)
-{
- JSMethodSpec* pMethods = NULL;
- int nSize = 0;
-
- if (sObjName == CJS_App::m_pClassName)
- CJS_App::GetMethods(pMethods, nSize);
- else if (sObjName == CJS_Color::m_pClassName)
- CJS_Color::GetMethods(pMethods, nSize);
- else if (sObjName == L"this")
- {
- if (GetReaderDocument())
- CJS_Document::GetMethods(pMethods, nSize);
- else
- CJS_App::GetMethods(pMethods, nSize);
- }
- else if (sObjName == CJS_Event::m_pClassName)
- CJS_Event::GetMethods(pMethods, nSize);
- else if (sObjName == CJS_Field::m_pClassName)
- CJS_Field::GetMethods(pMethods, nSize);
- else if (sObjName == CJS_Global::m_pClassName)
- CJS_Global::GetMethods(pMethods, nSize);
- else if (sObjName == CJS_Util::m_pClassName)
- CJS_Util::GetMethods(pMethods, nSize);
-
- for (int i=0; i<nSize; i++)
- array.Add(pMethods[i].pName);
-}
-
-FX_BOOL CJS_Runtime::IsEntered()
-{
- return v8::Isolate::GetCurrent() == m_isolate;
-}
-void CJS_Runtime::Exit()
-{
- if(m_isolate) m_isolate->Exit();
-}
-void CJS_Runtime::Enter()
-{
- if(m_isolate) m_isolate->Enter();
-}