summaryrefslogtreecommitdiff
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
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>
-rw-r--r--fxjs/cjs_document.cpp4
-rw-r--r--fxjs/cjs_document.h2
-rw-r--r--fxjs/cjs_field.cpp37
3 files changed, 22 insertions, 21 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index d4eca2f175..76d3f18b40 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -1474,8 +1474,8 @@ CJS_Return Document::gotoNamedDest(
return CJS_Return(true);
}
-void Document::AddDelayData(CJS_DelayData* pData) {
- m_DelayData.push_back(std::unique_ptr<CJS_DelayData>(pData));
+void Document::AddDelayData(std::unique_ptr<CJS_DelayData> pData) {
+ m_DelayData.push_back(std::move(pData));
}
void Document::DoFieldDelay(const WideString& sFieldName, int nControlIndex) {
diff --git a/fxjs/cjs_document.h b/fxjs/cjs_document.h
index edfaf96200..896522c684 100644
--- a/fxjs/cjs_document.h
+++ b/fxjs/cjs_document.h
@@ -211,7 +211,7 @@ class Document : public CJS_EmbedObj {
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
return m_pFormFillEnv.Get();
}
- void AddDelayData(CJS_DelayData* pData);
+ void AddDelayData(std::unique_ptr<CJS_DelayData> pData);
void DoFieldDelay(const WideString& sFieldName, int nControlIndex);
CJS_Document* GetCJSDoc() const;
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,