summaryrefslogtreecommitdiff
path: root/fxjs/cjs_field.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-01-29 20:17:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-29 20:17:36 +0000
commit75acda66db9db257ec92172ea1a30b6616117b8d (patch)
treeecca3080466c94ce802b38ba446613a3f07516c3 /fxjs/cjs_field.cpp
parent5e332f1275dd6f4b6d487d313f4db8497df339ab (diff)
downloadpdfium-75acda66db9db257ec92172ea1a30b6616117b8d.tar.xz
Kill some bare |new|s in cjs_field.cpp
Change-Id: Id4d9f21d94d8b21199846ec5f7613590fd20579e Reviewed-on: https://pdfium-review.googlesource.com/24310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_field.cpp')
-rw-r--r--fxjs/cjs_field.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 7f530cf4d8..b9b93d40a5 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
#include <memory>
+#include <utility>
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfdoc/cpdf_formfield.h"
@@ -2590,47 +2591,47 @@ CJS_Return Field::set_source(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
}
void Field::AddDelay_Int(FIELD_PROP prop, int32_t n) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->num = n;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::AddDelay_Bool(FIELD_PROP prop, bool b) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->b = b;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::AddDelay_String(FIELD_PROP prop, const ByteString& string) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->string = string;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->rect = rect;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::AddDelay_WordArray(FIELD_PROP prop,
const std::vector<uint32_t>& array) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->wordarray = array;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::AddDelay_WideStringArray(FIELD_PROP prop,
const std::vector<WideString>& array) {
- CJS_DelayData* pNewData =
- new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
+ auto pNewData =
+ pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestringarray = array;
- m_pJSDoc->AddDelayData(pNewData);
+ m_pJSDoc->AddDelayData(std::move(pNewData));
}
void Field::DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,