summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-31 11:34:04 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-31 11:34:04 -0700
commit86fad999ba59b1f8780582cc683b008880aab42e (patch)
treebc63f57e472a4aca6c2316eea4707d0aa415c122 /xfa/fxfa/app
parent4dce6d4689d464c3a8825a5d6aa790adfc9228ee (diff)
downloadpdfium-86fad999ba59b1f8780582cc683b008880aab42e.tar.xz
Replace CFXJSE_Value create/destroy with new and delete.
In most cases, the destroy calls were removed and the object wrapped in a unique_ptr. Review-Url: https://codereview.chromium.org/2014323003
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp3
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp29
2 files changed, 16 insertions, 16 deletions
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 29da4860b3..9524a25b1a 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -29,6 +29,7 @@
#include "xfa/fxfa/include/xfa_ffpageview.h"
#include "xfa/fxfa/include/xfa_ffwidget.h"
#include "xfa/fxfa/include/xfa_ffwidgethandler.h"
+#include "xfa/fxjse/value.h"
static void XFA_FFDeleteWidgetAcc(void* pData) {
delete static_cast<CXFA_WidgetAcc*>(pData);
@@ -206,7 +207,7 @@ FX_BOOL CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) {
pWidgetAcc->ExecuteScript(CXFA_Script(pScript), &EventParam, &pRetValue);
if (iRet == XFA_EVENTERROR_Success && pRetValue) {
bRet = FXJSE_Value_ToBoolean(pRetValue);
- FXJSE_Value_Release(pRetValue);
+ delete pRetValue;
}
return bRet;
}
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 1ba6c85804..e3429c553f 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -26,6 +26,7 @@
#include "xfa/fxfa/parser/xfa_localevalue.h"
#include "xfa/fxfa/parser/xfa_script.h"
#include "xfa/fxfa/parser/xfa_script_imp.h"
+#include "xfa/fxjse/value.h"
static void XFA_FFDeleteCalcData(void* pData) {
if (pData) {
@@ -609,9 +610,8 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
if (iFormat != XFA_EVENTERROR_Success) {
ProcessScriptTestValidate(validate, iRet, pRetValue, bVersionFlag);
}
- if (pRetValue) {
- FXJSE_Value_Release(pRetValue);
- }
+ delete pRetValue;
+
return iRet | iFormat;
}
int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
@@ -645,21 +645,22 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
pEventParam->m_eType == XFA_EVENT_Calculate) {
pContext->SetNodesOfRunScript(&refNodes);
}
- CFXJSE_Value* pTmpRetValue = FXJSE_Value_Create(pContext->GetRuntime());
+ std::unique_ptr<CFXJSE_Value> pTmpRetValue(
+ new CFXJSE_Value(pContext->GetRuntime()));
++m_nRecursionDepth;
- FX_BOOL bRet =
- pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
- wsExpression.AsStringC(), pTmpRetValue, m_pNode);
+ FX_BOOL bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType,
+ wsExpression.AsStringC(),
+ pTmpRetValue.get(), m_pNode);
--m_nRecursionDepth;
int32_t iRet = XFA_EVENTERROR_Error;
if (bRet) {
iRet = XFA_EVENTERROR_Success;
if (pEventParam->m_eType == XFA_EVENT_Calculate ||
pEventParam->m_eType == XFA_EVENT_InitCalculate) {
- if (!FXJSE_Value_IsUndefined(pTmpRetValue)) {
- if (!FXJSE_Value_IsNull(pTmpRetValue)) {
+ if (!FXJSE_Value_IsUndefined(pTmpRetValue.get())) {
+ if (!FXJSE_Value_IsNull(pTmpRetValue.get())) {
CFX_ByteString bsString;
- FXJSE_Value_ToUTF8String(pTmpRetValue, bsString);
+ FXJSE_Value_ToUTF8String(pTmpRetValue.get(), bsString);
pEventParam->m_wsResult =
CFX_WideString::FromUTF8(bsString.AsStringC());
}
@@ -694,11 +695,9 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
}
}
}
- if (pRetValue) {
- *pRetValue = pTmpRetValue;
- } else {
- FXJSE_Value_Release(pTmpRetValue);
- }
+ if (pRetValue)
+ *pRetValue = pTmpRetValue.release();
+
pContext->SetNodesOfRunScript(NULL);
return iRet;
}