diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-22 11:06:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-22 11:06:02 -0700 |
commit | 8e0638b1531493e2d5fe3a603f4be60418c78bc4 (patch) | |
tree | 76792886acce1d8251261eb35489698808f3c761 /fpdfsdk/javascript | |
parent | a4ad5957af799374d4710f3847b85f57bea13f47 (diff) | |
download | pdfium-8e0638b1531493e2d5fe3a603f4be60418c78bc4.tar.xz |
Rename App to Env where needed.
More instances of CPDFSDK_Environment being called m_pApp in the code. Renamed
to m_pEnv to be clear that it's the environment not an app object.
Review-Url: https://codereview.chromium.org/2354413002
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/PublicMethods.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/javascript/app.cpp | 46 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_context.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_context.h | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.h | 4 | ||||
-rw-r--r-- | fpdfsdk/javascript/global.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/javascript/global.h | 4 |
9 files changed, 44 insertions, 44 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 8935037ec8..ea225f095d 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -407,7 +407,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc, return FALSE; pRuntime->BeginBlock(); - CPDFSDK_Environment* pEnv = pContext->GetReaderApp(); + CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); @@ -755,7 +755,7 @@ FX_BOOL Document::mailDoc(IJS_Context* cc, } pRuntime->BeginBlock(); - CPDFSDK_Environment* pEnv = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 435c383b34..65af6a1fa5 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -80,9 +80,9 @@ CFX_WideString StrTrim(const CFX_WideString& pStr) { } void AlertIfPossible(CJS_Context* pContext, const FX_WCHAR* swMsg) { - CPDFSDK_Environment* pApp = pContext->GetReaderApp(); - if (pApp) - pApp->JS_appAlert(swMsg, nullptr, 0, 3); + CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + if (pEnv) + pEnv->JS_appAlert(swMsg, nullptr, 0, 3); } } // namespace diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index fc2a440da9..a6c6c73528 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -25,7 +25,7 @@ class GlobalTimer { public: GlobalTimer(app* pObj, - CPDFSDK_Environment* pApp, + CPDFSDK_Environment* pEnv, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -55,11 +55,11 @@ class GlobalTimer { const uint32_t m_dwTimeOut; const CFX_WideString m_swJScript; CJS_Runtime::ObservedPtr m_pRuntime; - CPDFSDK_Environment* const m_pApp; + CPDFSDK_Environment* const m_pEnv; }; GlobalTimer::GlobalTimer(app* pObj, - CPDFSDK_Environment* pApp, + CPDFSDK_Environment* pEnv, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -72,8 +72,8 @@ GlobalTimer::GlobalTimer(app* pObj, m_dwTimeOut(dwTimeOut), m_swJScript(script), m_pRuntime(pRuntime), - m_pApp(pApp) { - CFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); + m_pEnv(pEnv) { + CFX_SystemHandler* pHandler = m_pEnv->GetSysHandler(); m_nTimerID = pHandler->SetTimer(dwElapse, Trigger); (*GetGlobalTimerMap())[m_nTimerID] = this; } @@ -83,7 +83,7 @@ GlobalTimer::~GlobalTimer() { return; if (GetRuntime()) - m_pApp->GetSysHandler()->KillTimer(m_nTimerID); + m_pEnv->GetSysHandler()->KillTimer(m_nTimerID); GetGlobalTimerMap()->erase(m_nTimerID); } @@ -217,11 +217,11 @@ FX_BOOL app::activeDocs(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - CPDFSDK_Environment* pApp = pContext->GetReaderApp(); + CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); CJS_Array aDocs; - if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { + if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) { CJS_Document* pJSDocument = nullptr; if (pDoc == pCurDoc) { v8::Local<v8::Object> pObj = pRuntime->GetThisObj(); @@ -255,8 +255,8 @@ FX_BOOL app::calculate(IJS_Context* cc, m_bCalculate = (FX_BOOL)bVP; CJS_Context* pContext = (CJS_Context*)cc; - CPDFSDK_Environment* pApp = pContext->GetReaderApp(); - if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) + CPDFSDK_Environment* pEnv = pContext->GetReaderEnv(); + if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); } else { vp << (bool)m_bCalculate; @@ -322,7 +322,7 @@ FX_BOOL app::platform(IJS_Context* cc, return FALSE; #ifdef PDF_ENABLE_XFA CPDFSDK_Environment* pEnv = - static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); + static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderEnv(); if (!pEnv) return FALSE; CFX_WideString platfrom = pEnv->GetPlatform(); @@ -342,7 +342,7 @@ FX_BOOL app::language(IJS_Context* cc, return FALSE; #ifdef PDF_ENABLE_XFA CPDFSDK_Environment* pEnv = - static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderApp(); + static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetReaderEnv(); if (!pEnv) return FALSE; CFX_WideString language = pEnv->GetLanguage(); @@ -391,8 +391,8 @@ FX_BOOL app::alert(IJS_Context* cc, return FALSE; } - CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); - if (!pApp) { + CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); + if (!pEnv) { vRet = CJS_Value(pRuntime, 0); return TRUE; } @@ -432,10 +432,10 @@ FX_BOOL app::alert(IJS_Context* cc, swTitle = JSGetStringFromID(IDS_STRING_JSALERT); pRuntime->BeginBlock(); - if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) + if (CPDFSDK_Document* pDoc = pEnv->GetSDKDocument()) pDoc->KillFocusAnnot(); - vRet = CJS_Value(pRuntime, pApp->JS_appAlert(swMsg.c_str(), swTitle.c_str(), + vRet = CJS_Value(pRuntime, pEnv->JS_appAlert(swMsg.c_str(), swTitle.c_str(), iType, iIcon)); pRuntime->EndBlock(); return TRUE; @@ -447,7 +447,7 @@ FX_BOOL app::beep(IJS_Context* cc, CFX_WideString& sError) { if (params.size() == 1) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); - CPDFSDK_Environment* pEnv = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); pEnv->JS_appBeep(params[0].ToInt(pRuntime)); return TRUE; } @@ -492,10 +492,10 @@ FX_BOOL app::setInterval(IJS_Context* cc, } uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); GlobalTimer* timerRef = - new GlobalTimer(this, pApp, pRuntime, 0, script, dwInterval, 0); + new GlobalTimer(this, pEnv, pRuntime, 0, script, dwInterval, 0); m_Timers.insert(std::unique_ptr<GlobalTimer>(timerRef)); v8::Local<v8::Object> pRetObj = @@ -526,10 +526,10 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, } uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderEnv(); GlobalTimer* timerRef = - new GlobalTimer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut); + new GlobalTimer(this, pEnv, pRuntime, 1, script, dwTimeOut, dwTimeOut); m_Timers.insert(std::unique_ptr<GlobalTimer>(timerRef)); v8::Local<v8::Object> pRetObj = @@ -677,7 +677,7 @@ FX_BOOL app::mailMsg(IJS_Context* cc, pRuntime->BeginBlock(); CJS_Context* pContext = static_cast<CJS_Context*>(cc); - pContext->GetReaderApp()->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), + pContext->GetReaderEnv()->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); @@ -792,7 +792,7 @@ FX_BOOL app::response(IJS_Context* cc, memset(pBuff.get(), 0, MAX_INPUT_BYTES + 2); CJS_Context* pContext = static_cast<CJS_Context*>(cc); - int nLengthBytes = pContext->GetReaderApp()->JS_appResponse( + int nLengthBytes = pContext->GetReaderEnv()->JS_appResponse( swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(), bPassword, pBuff.get(), MAX_INPUT_BYTES); diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp index 4a6e4d3a64..3f13cd3dc1 100644 --- a/fpdfsdk/javascript/cjs_context.cpp +++ b/fpdfsdk/javascript/cjs_context.cpp @@ -21,8 +21,8 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() { return m_pRuntime->GetReaderDocument(); } -CPDFSDK_Environment* CJS_Context::GetReaderApp() { - return m_pRuntime->GetReaderApp(); +CPDFSDK_Environment* CJS_Context::GetReaderEnv() { + return m_pRuntime->GetReaderEnv(); } FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h index 03403de6b3..41f2042b7e 100644 --- a/fpdfsdk/javascript/cjs_context.h +++ b/fpdfsdk/javascript/cjs_context.h @@ -125,7 +125,7 @@ class CJS_Context : public IJS_Context { CJS_Runtime* GetJSRuntime() const { return m_pRuntime; } CJS_EventHandler* GetEventHandler() const { return m_pEventHandler.get(); } - CPDFSDK_Environment* GetReaderApp(); + CPDFSDK_Environment* GetReaderEnv(); CPDFSDK_Document* GetReaderDocument(); private: diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 1afde804ca..0ca64b10f3 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -63,14 +63,14 @@ CJS_Runtime* CJS_Runtime::CurrentRuntimeFromIsolate(v8::Isolate* pIsolate) { CFXJS_Engine::CurrentEngineFromIsolate(pIsolate)); } -CJS_Runtime::CJS_Runtime(CPDFSDK_Environment* pApp) - : m_pApp(pApp), +CJS_Runtime::CJS_Runtime(CPDFSDK_Environment* pEnv) + : m_pEnv(pEnv), m_pDocument(nullptr), m_bBlocking(false), m_isolateManaged(false) { v8::Isolate* pIsolate = nullptr; #ifndef PDF_ENABLE_XFA - IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform; + IPDF_JSPLATFORM* pPlatform = m_pEnv->GetFormFillInfo()->m_pJsPlatform; if (pPlatform->version <= 2) { unsigned int embedderDataSlot = 0; v8::Isolate* pExternalIsolate = nullptr; @@ -88,7 +88,7 @@ CJS_Runtime::CJS_Runtime(CPDFSDK_Environment* pApp) pIsolate = CPDFXFA_App::GetInstance()->GetJSERuntime(); SetIsolate(pIsolate); } else { - IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform; + IPDF_JSPLATFORM* pPlatform = m_pEnv->GetFormFillInfo()->m_pJsPlatform; if (pPlatform->version <= 2) { unsigned int embedderDataSlot = 0; v8::Isolate* pExternalIsolate = nullptr; diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index 12f902d7df..da7e384321 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -42,7 +42,7 @@ class CJS_Runtime : public IJS_Runtime, int ExecuteScript(const CFX_WideString& script, CFX_WideString* info) override; - CPDFSDK_Environment* GetReaderApp() const { return m_pApp; } + CPDFSDK_Environment* GetReaderEnv() const { return m_pEnv; } // Returns true if the event isn't already found in the set. bool AddEventToSet(const FieldEvent& event); @@ -63,7 +63,7 @@ class CJS_Runtime : public IJS_Runtime, void DefineJSObjects(); std::vector<std::unique_ptr<CJS_Context>> m_ContextArray; - CPDFSDK_Environment* const m_pApp; + CPDFSDK_Environment* const m_pEnv; CPDFSDK_Document* m_pDocument; bool m_bBlocking; bool m_isolateManaged; diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index 42ae8d54ce..b55953907f 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -33,7 +33,7 @@ void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); JSGlobalAlternate* pGlobal = static_cast<JSGlobalAlternate*>(GetEmbedObject()); - pGlobal->Initial(pRuntime->GetReaderApp()); + pGlobal->Initial(pRuntime->GetReaderEnv()); } JSGlobalData::JSGlobalData() @@ -49,16 +49,16 @@ JSGlobalData::~JSGlobalData() { } JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) - : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {} + : CJS_EmbedObj(pJSObject), m_pEnv(nullptr) {} JSGlobalAlternate::~JSGlobalAlternate() { DestroyGlobalPersisitentVariables(); m_pGlobalData->Release(); } -void JSGlobalAlternate::Initial(CPDFSDK_Environment* pApp) { - m_pApp = pApp; - m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pApp); +void JSGlobalAlternate::Initial(CPDFSDK_Environment* pEnv) { + m_pEnv = pEnv; + m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pEnv); UpdateGlobalPersistentVariables(); } diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index 165cf3a443..6a104be60f 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -47,7 +47,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { FX_BOOL DelProperty(IJS_Context* cc, const FX_WCHAR* propname, CFX_WideString& sError); - void Initial(CPDFSDK_Environment* pApp); + void Initial(CPDFSDK_Environment* pEnv); private: void UpdateGlobalPersistentVariables(); @@ -68,7 +68,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { std::map<CFX_ByteString, JSGlobalData*> m_mapGlobal; CFX_WideString m_sFilePath; CJS_GlobalData* m_pGlobalData; - CPDFSDK_Environment* m_pApp; + CPDFSDK_Environment* m_pEnv; }; class CJS_Global : public CJS_Object { |