Merge to XFA: Kill off unused IFXJS interface methods.
authorTom Sepez <tsepez@chromium.org>
Wed, 25 Feb 2015 22:54:36 +0000 (14:54 -0800)
committerTom Sepez <tsepez@chromium.org>
Wed, 25 Feb 2015 22:54:36 +0000 (14:54 -0800)
Original Review URL: https://codereview.chromium.org/954923004
TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/952213004

fpdfsdk/include/javascript/IJavaScript.h
fpdfsdk/include/javascript/JS_Define.h
fpdfsdk/include/javascript/JS_Runtime.h
fpdfsdk/src/javascript/JS_Runtime.cpp

index 9d50b04..91fd9c6 100644 (file)
@@ -74,16 +74,9 @@ 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 CPDFSDK_Document*       GetReaderDocument() = 0;
 
-       virtual void                            Exit() = 0;
-       virtual void                            Enter() = 0;
-       virtual FX_BOOL                         IsEntered() = 0;
        virtual FX_BOOL                         GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue) = 0;
        virtual FX_BOOL                         SetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue) = 0;
 
index 72a481d..fee16e4 100644 (file)
@@ -167,9 +167,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[];\
@@ -211,21 +208,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)
@@ -234,7 +216,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
 
@@ -259,11 +240,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 =============================================== */
@@ -349,9 +325,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[];\
@@ -416,21 +389,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 ============================================ */
index 217a985..96f00bb 100644 (file)
@@ -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();
index b0e80dd..4b4328c 100644 (file)
@@ -340,149 +340,6 @@ 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();
-}
 FX_BOOL        CJS_Runtime::GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue)
 {
        FX_LPCSTR name = utf8Name.GetCStr();