Replace pdfium::MakeUnique<T> with std::make_unique<T> in fxjs
Using C++14 as a baseline permits this.
-- ensure <memory> included in .cpp or corresponding .h file
-- remove ptr_util.h include unless WrapUnique() (no cases).
Change-Id: I7cddd65e42c28186af88018ee4742a621aaa3a31
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69936
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp
index 9131f02..1cc1247 100644
--- a/fxjs/cfx_globaldata.cpp
+++ b/fxjs/cfx_globaldata.cpp
@@ -9,7 +9,6 @@
#include <utility>
#include "core/fdrm/fx_crypt.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
namespace {
@@ -139,7 +138,7 @@
pData->data.dData = dData;
return;
}
- auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
+ auto pNewData = std::make_unique<CFX_GlobalData::Element>();
pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = CFX_Value::DataType::NUMBER;
pNewData->data.dData = dData;
@@ -157,7 +156,7 @@
pData->data.bData = bData;
return;
}
- auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
+ auto pNewData = std::make_unique<CFX_GlobalData::Element>();
pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = CFX_Value::DataType::BOOLEAN;
pNewData->data.bData = bData;
@@ -175,7 +174,7 @@
pData->data.sData = sData;
return;
}
- auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
+ auto pNewData = std::make_unique<CFX_GlobalData::Element>();
pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = CFX_Value::DataType::STRING;
pNewData->data.sData = sData;
@@ -194,7 +193,7 @@
pData->data.objData = std::move(array);
return;
}
- auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
+ auto pNewData = std::make_unique<CFX_GlobalData::Element>();
pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = CFX_Value::DataType::OBJECT;
pNewData->data.objData = std::move(array);
@@ -210,7 +209,7 @@
pData->data.nType = CFX_Value::DataType::NULLOBJ;
return;
}
- auto pNewData = pdfium::MakeUnique<CFX_GlobalData::Element>();
+ auto pNewData = std::make_unique<CFX_GlobalData::Element>();
pNewData->data.sKey = std::move(sPropName);
pNewData->data.nType = CFX_Value::DataType::NULLOBJ;
m_arrayGlobalData.push_back(std::move(pNewData));
diff --git a/fxjs/cfx_v8_unittest.cpp b/fxjs/cfx_v8_unittest.cpp
index 762ecd7..d9358da 100644
--- a/fxjs/cfx_v8_unittest.cpp
+++ b/fxjs/cfx_v8_unittest.cpp
@@ -9,7 +9,6 @@
#include "fxjs/cfx_v8.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
namespace {
bool getter_sentinel = false;
@@ -25,13 +24,13 @@
FXV8UnitTest::~FXV8UnitTest() = default;
void FXV8UnitTest::SetUp() {
- array_buffer_allocator_ = pdfium::MakeUnique<CFX_V8ArrayBufferAllocator>();
+ array_buffer_allocator_ = std::make_unique<CFX_V8ArrayBufferAllocator>();
v8::Isolate::CreateParams params;
params.array_buffer_allocator = array_buffer_allocator_.get();
isolate_.reset(v8::Isolate::New(params));
- cfx_v8_ = pdfium::MakeUnique<CFX_V8>(isolate_.get());
+ cfx_v8_ = std::make_unique<CFX_V8>(isolate_.get());
}
TEST_F(FXV8UnitTest, EmptyLocal) {
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index 9624feb..0216b3f 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -14,7 +14,6 @@
#include "fxjs/cjs_object.h"
#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_runtimedata.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "v8/include/v8-util.h"
@@ -379,8 +378,8 @@
FXJS_PerIsolateData::SetUp(GetIsolate());
FXJS_PerIsolateData* pIsolateData = FXJS_PerIsolateData::Get(GetIsolate());
return pIsolateData->AssignIDForObjDefinition(
- pdfium::MakeUnique<CFXJS_ObjDefinition>(GetIsolate(), sObjName, eObjType,
- pConstructor, pDestructor));
+ std::make_unique<CFXJS_ObjDefinition>(GetIsolate(), sObjName, eObjType,
+ pConstructor, pDestructor));
}
void CFXJS_Engine::DefineObjMethod(int nObjDefnID,
diff --git a/fxjs/cfxjs_engine_unittest.cpp b/fxjs/cfxjs_engine_unittest.cpp
index e0f7301..c8e844c 100644
--- a/fxjs/cfxjs_engine_unittest.cpp
+++ b/fxjs/cfxjs_engine_unittest.cpp
@@ -9,7 +9,6 @@
#include "fxjs/cfx_v8_unittest.h"
#include "fxjs/cjs_object.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
class FXJSEngineUnitTest : public FXV8UnitTest {
public:
@@ -19,7 +18,7 @@
void SetUp() override {
FXV8UnitTest::SetUp();
FXJS_Initialize(1, isolate());
- engine_ = pdfium::MakeUnique<CFXJS_Engine>(isolate());
+ engine_ = std::make_unique<CFXJS_Engine>(isolate());
}
void TearDown() override { FXJS_Release(); }
@@ -44,7 +43,7 @@
"perm", FXJSOBJTYPE_DYNAMIC,
[](CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) {
pEngine->SetObjectPrivate(obj,
- pdfium::MakeUnique<CJS_Object>(obj, nullptr));
+ std::make_unique<CJS_Object>(obj, nullptr));
perm_created = true;
},
[](v8::Local<v8::Object> obj) {
@@ -57,7 +56,7 @@
"temp", FXJSOBJTYPE_DYNAMIC,
[](CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) {
pEngine->SetObjectPrivate(obj,
- pdfium::MakeUnique<CJS_Object>(obj, nullptr));
+ std::make_unique<CJS_Object>(obj, nullptr));
temp_created = true;
},
[](v8::Local<v8::Object> obj) {
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp
index 36dece0..bc71094 100644
--- a/fxjs/cjs_app.cpp
+++ b/fxjs/cjs_app.cpp
@@ -14,7 +14,6 @@
#include "fxjs/global_timer.h"
#include "fxjs/ijs_event_context.h"
#include "fxjs/js_resources.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#define JS_STR_VIEWERTYPE L"pdfium"
@@ -302,7 +301,7 @@
return CJS_Result::Failure(JSMessage::kInvalidInputError);
uint32_t dwInterval = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
- auto timerRef = pdfium::MakeUnique<GlobalTimer>(
+ auto timerRef = std::make_unique<GlobalTimer>(
this, pRuntime, GlobalTimer::Type::kRepeating, script, dwInterval, 0);
GlobalTimer* pTimerRef = timerRef.get();
m_Timers.insert(std::move(timerRef));
@@ -330,9 +329,9 @@
return CJS_Result::Failure(JSMessage::kInvalidInputError);
uint32_t dwTimeOut = params.size() > 1 ? pRuntime->ToInt32(params[1]) : 1000;
- auto timerRef = pdfium::MakeUnique<GlobalTimer>(this, pRuntime,
- GlobalTimer::Type::kOneShot,
- script, dwTimeOut, dwTimeOut);
+ auto timerRef =
+ std::make_unique<GlobalTimer>(this, pRuntime, GlobalTimer::Type::kOneShot,
+ script, dwTimeOut, dwTimeOut);
GlobalTimer* pTimerRef = timerRef.get();
m_Timers.insert(std::move(timerRef));
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 14c7a20..a7de0be 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -1254,7 +1254,7 @@
return CJS_Result::Failure(JSMessage::kBadObjectError);
auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict);
- page->SetRenderCache(pdfium::MakeUnique<CPDF_PageRenderCache>(page.Get()));
+ page->SetRenderCache(std::make_unique<CPDF_PageRenderCache>(page.Get()));
page->ParseContent();
int nWords = 0;
@@ -1309,7 +1309,7 @@
return CJS_Result::Failure(JSMessage::kBadObjectError);
auto page = pdfium::MakeRetain<CPDF_Page>(pDocument, pPageDict);
- page->SetRenderCache(pdfium::MakeUnique<CPDF_PageRenderCache>(page.Get()));
+ page->SetRenderCache(std::make_unique<CPDF_PageRenderCache>(page.Get()));
page->ParseContent();
int nWords = 0;
diff --git a/fxjs/cjs_event_context.cpp b/fxjs/cjs_event_context.cpp
index 27e8120..b308c47 100644
--- a/fxjs/cjs_event_context.cpp
+++ b/fxjs/cjs_event_context.cpp
@@ -12,11 +12,10 @@
#include "fxjs/cjs_runtime.h"
#include "fxjs/js_define.h"
#include "fxjs/js_resources.h"
-#include "third_party/base/ptr_util.h"
CJS_EventContext::CJS_EventContext(CJS_Runtime* pRuntime)
: m_pRuntime(pRuntime),
- m_pEventRecorder(pdfium::MakeUnique<CJS_EventRecorder>()) {
+ m_pEventRecorder(std::make_unique<CJS_EventRecorder>()) {
ASSERT(pRuntime);
}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 1cd0d3f..0ae6e48 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -25,7 +25,6 @@
#include "fxjs/cjs_document.h"
#include "fxjs/cjs_icon.h"
#include "fxjs/js_resources.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -2376,7 +2375,7 @@
std::vector<std::unique_ptr<WideString>> swSort;
for (CPDF_FormField* pFormField : FieldArray) {
- swSort.push_back(pdfium::MakeUnique<WideString>(pFormField->GetFullName()));
+ swSort.push_back(std::make_unique<WideString>(pFormField->GetFullName()));
}
std::sort(swSort.begin(), swSort.end(),
@@ -2581,28 +2580,28 @@
void CJS_Field::AddDelay_Int(FIELD_PROP prop, int32_t n) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->num = n;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
void CJS_Field::AddDelay_Bool(FIELD_PROP prop, bool b) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->b = b;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
void CJS_Field::AddDelay_String(FIELD_PROP prop, const ByteString& str) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->bytestring = str;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
void CJS_Field::AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->rect = rect;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
@@ -2610,7 +2609,7 @@
void CJS_Field::AddDelay_WordArray(FIELD_PROP prop,
const std::vector<uint32_t>& array) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->wordarray = array;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
@@ -2618,7 +2617,7 @@
void CJS_Field::AddDelay_WideStringArray(FIELD_PROP prop,
const std::vector<WideString>& array) {
auto pNewData =
- pdfium::MakeUnique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
+ std::make_unique<CJS_DelayData>(prop, m_nFormControlIndex, m_FieldName);
pNewData->widestringarray = array;
m_pJSDoc->AddDelayData(std::move(pNewData));
}
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 925b665..ed50c93 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -19,7 +19,6 @@
#include "fxjs/cjs_object.h"
#include "fxjs/js_define.h"
#include "fxjs/js_resources.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -407,7 +406,7 @@
v8::Local<v8::Value> v =
pRuntime->GetObjectProperty(pObj, sKey.AsStringView());
if (v->IsNumber()) {
- auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
+ auto pObjElement = std::make_unique<CFX_KeyValue>();
pObjElement->nType = CFX_Value::DataType::NUMBER;
pObjElement->sKey = sKey;
pObjElement->dData = pRuntime->ToDouble(v);
@@ -415,7 +414,7 @@
continue;
}
if (v->IsBoolean()) {
- auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
+ auto pObjElement = std::make_unique<CFX_KeyValue>();
pObjElement->nType = CFX_Value::DataType::BOOLEAN;
pObjElement->sKey = sKey;
pObjElement->dData = pRuntime->ToBoolean(v);
@@ -424,7 +423,7 @@
}
if (v->IsString()) {
ByteString sValue = pRuntime->ToWideString(v).ToDefANSI();
- auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
+ auto pObjElement = std::make_unique<CFX_KeyValue>();
pObjElement->nType = CFX_Value::DataType::STRING;
pObjElement->sKey = sKey;
pObjElement->sData = sValue;
@@ -432,7 +431,7 @@
continue;
}
if (v->IsObject()) {
- auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
+ auto pObjElement = std::make_unique<CFX_KeyValue>();
pObjElement->nType = CFX_Value::DataType::OBJECT;
pObjElement->sKey = sKey;
ObjectToArray(pRuntime, pRuntime->ToObject(v), &pObjElement->objData);
@@ -440,7 +439,7 @@
continue;
}
if (v->IsNull()) {
- auto pObjElement = pdfium::MakeUnique<CFX_KeyValue>();
+ auto pObjElement = std::make_unique<CFX_KeyValue>();
pObjElement->nType = CFX_Value::DataType::NULLOBJ;
pObjElement->sKey = sKey;
pArray->push_back(std::move(pObjElement));
@@ -533,7 +532,7 @@
return CJS_Result::Success();
}
- auto pNewData = pdfium::MakeUnique<JSGlobalData>();
+ auto pNewData = std::make_unique<JSGlobalData>();
switch (nType) {
case CFX_Value::DataType::NUMBER:
pNewData->nType = CFX_Value::DataType::NUMBER;
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index dba7e32..adf1f50 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -38,7 +38,6 @@
#include "fxjs/cjs_zoomtype.h"
#include "fxjs/fxv8.h"
#include "fxjs/js_define.h"
-#include "third_party/base/ptr_util.h"
CJS_Runtime::CJS_Runtime(CPDFSDK_FormFillEnvironment* pFormFillEnv)
: m_pFormFillEnv(pFormFillEnv) {
@@ -121,7 +120,7 @@
}
IJS_EventContext* CJS_Runtime::NewEventContext() {
- m_EventContextArray.push_back(pdfium::MakeUnique<CJS_EventContext>(this));
+ m_EventContextArray.push_back(std::make_unique<CJS_EventContext>(this));
return m_EventContextArray.back().get();
}
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp
index 6e313de..fe5b1f6 100644
--- a/fxjs/cjs_runtimestub.cpp
+++ b/fxjs/cjs_runtimestub.cpp
@@ -7,7 +7,6 @@
#include "fxjs/cjs_runtimestub.h"
#include "fxjs/cjs_event_context_stub.h"
-#include "third_party/base/ptr_util.h"
CJS_RuntimeStub::CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv)
: m_pFormFillEnv(pFormFillEnv) {}
@@ -16,7 +15,7 @@
IJS_EventContext* CJS_RuntimeStub::NewEventContext() {
if (!m_pContext)
- m_pContext = pdfium::MakeUnique<CJS_EventContextStub>();
+ m_pContext = std::make_unique<CJS_EventContextStub>();
return m_pContext.get();
}
diff --git a/fxjs/ijs_runtime.cpp b/fxjs/ijs_runtime.cpp
index 34a846e..4427a5c 100644
--- a/fxjs/ijs_runtime.cpp
+++ b/fxjs/ijs_runtime.cpp
@@ -5,7 +5,6 @@
#include "fxjs/ijs_runtime.h"
#include "fxjs/cjs_runtimestub.h"
-#include "third_party/base/ptr_util.h"
#ifdef PDF_ENABLE_V8
#include "fxjs/cfxjs_engine.h"
@@ -38,9 +37,9 @@
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
#ifdef PDF_ENABLE_V8
if (pFormFillEnv->IsJSPlatformPresent())
- return pdfium::MakeUnique<CJS_Runtime>(pFormFillEnv);
+ return std::make_unique<CJS_Runtime>(pFormFillEnv);
#endif
- return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv);
+ return std::make_unique<CJS_RuntimeStub>(pFormFillEnv);
}
IJS_Runtime::~IJS_Runtime() = default;
diff --git a/fxjs/js_define.h b/fxjs/js_define.h
index 2c15c9f..f722eab 100644
--- a/fxjs/js_define.h
+++ b/fxjs/js_define.h
@@ -7,6 +7,7 @@
#ifndef FXJS_JS_DEFINE_H_
#define FXJS_JS_DEFINE_H_
+#include <memory>
#include <vector>
#include "core/fxcrt/unowned_ptr.h"
@@ -44,7 +45,7 @@
template <class T>
static void JSConstructor(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) {
pEngine->SetObjectPrivate(
- obj, pdfium::MakeUnique<T>(obj, static_cast<CJS_Runtime*>(pEngine)));
+ obj, std::make_unique<T>(obj, static_cast<CJS_Runtime*>(pEngine)));
}
// CJS_Object has virtual dtor, template not required.
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index b411bcd..56f9458 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -16,7 +16,6 @@
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
using pdfium::fxjse::kClassTag;
using pdfium::fxjse::kFuncTag;
@@ -187,7 +186,7 @@
v8::HandleScope scope(info.GetIsolate());
v8::String::Utf8Value szPropName(info.GetIsolate(), property);
ByteStringView szFxPropName(*szPropName, szPropName.length());
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpThisValue = std::make_unique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
if (DynPropQueryAdapter(lpClass, lpThisValue.get(), szFxPropName)) {
info.GetReturnValue().Set(v8::DontDelete);
@@ -208,9 +207,9 @@
v8::String::Utf8Value szPropName(info.GetIsolate(), property);
ByteStringView szFxPropName(*szPropName, szPropName.length());
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpThisValue = std::make_unique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
- auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpNewValue = std::make_unique<CFXJSE_Value>(info.GetIsolate());
DynPropGetterAdapter(info.GetIsolate(), lpClass, lpThisValue.get(),
szFxPropName, lpNewValue.get());
info.GetReturnValue().Set(lpNewValue->DirectGetValue());
@@ -228,9 +227,9 @@
v8::String::Utf8Value szPropName(info.GetIsolate(), property);
ByteStringView szFxPropName(*szPropName, szPropName.length());
- auto lpThisValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpThisValue = std::make_unique<CFXJSE_Value>(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
- auto lpNewValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto lpNewValue = std::make_unique<CFXJSE_Value>(info.GetIsolate());
lpNewValue->ForceSetValue(value);
DynPropSetterAdapter(lpClass, lpThisValue.get(), szFxPropName,
lpNewValue.get());
@@ -273,7 +272,7 @@
return pExistingClass;
v8::Isolate* pIsolate = lpContext->GetIsolate();
- auto pClass = pdfium::MakeUnique<CFXJSE_Class>(lpContext);
+ auto pClass = std::make_unique<CFXJSE_Class>(lpContext);
pClass->m_szClassName = lpClassDefinition->name;
pClass->m_lpClassDefinition = lpClassDefinition;
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
diff --git a/fxjs/xfa/cfxjse_context.cpp b/fxjs/xfa/cfxjse_context.cpp
index a250755..e72cb2d 100644
--- a/fxjs/xfa/cfxjse_context.cpp
+++ b/fxjs/xfa/cfxjse_context.cpp
@@ -14,7 +14,6 @@
#include "fxjs/xfa/cfxjse_isolatetracker.h"
#include "fxjs/xfa/cfxjse_runtimedata.h"
#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
namespace {
@@ -176,7 +175,7 @@
const FXJSE_CLASS_DESCRIPTOR* pGlobalClass,
CFXJSE_HostObject* pGlobalObject) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
- auto pContext = pdfium::MakeUnique<CFXJSE_Context>(pIsolate);
+ auto pContext = std::make_unique<CFXJSE_Context>(pIsolate);
v8::Local<v8::ObjectTemplate> hObjectTemplate;
if (pGlobalClass) {
CFXJSE_Class* pGlobalClassObj =
@@ -213,7 +212,7 @@
CFXJSE_Context::~CFXJSE_Context() {}
std::unique_ptr<CFXJSE_Value> CFXJSE_Context::GetGlobalObject() {
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(GetIsolate());
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
v8::Local<v8::Context> hContext =
v8::Local<v8::Context>::New(GetIsolate(), m_hContext);
diff --git a/fxjs/xfa/cfxjse_engine.cpp b/fxjs/xfa/cfxjse_engine.cpp
index fe25f68..e3f6278 100644
--- a/fxjs/xfa/cfxjse_engine.cpp
+++ b/fxjs/xfa/cfxjse_engine.cpp
@@ -18,7 +18,6 @@
#include "fxjs/xfa/cfxjse_resolveprocessor.h"
#include "fxjs/xfa/cfxjse_value.h"
#include "fxjs/xfa/cjx_object.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
@@ -112,7 +111,7 @@
m_JsContext(CFXJSE_Context::Create(fxjs_runtime->GetIsolate(),
&GlobalClassDescriptor,
pDocument->GetRoot())),
- m_ResolveProcessor(pdfium::MakeUnique<CFXJSE_ResolveProcessor>()) {
+ m_ResolveProcessor(std::make_unique<CFXJSE_ResolveProcessor>()) {
RemoveBuiltInObjs(m_JsContext.get());
m_JsContext->EnableCompatibleMode();
@@ -139,7 +138,7 @@
m_eScriptType = eScriptType;
if (eScriptType == CXFA_Script::Type::Formcalc) {
if (!m_FM2JSContext) {
- m_FM2JSContext = pdfium::MakeUnique<CFXJSE_FormCalcContext>(
+ m_FM2JSContext = std::make_unique<CFXJSE_FormCalcContext>(
GetIsolate(), m_JsContext.get(), m_pDocument.Get());
}
CFX_WideTextBuf wsJavaScript;
@@ -547,7 +546,7 @@
return false;
ByteString btScript = wsScript->ToUTF8();
- auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto hRetValue = std::make_unique<CFXJSE_Value>(GetIsolate());
CXFA_Node* pThisObject = pParent->GetParent();
CFXJSE_Context* pVariablesContext =
CreateVariablesContext(pScriptNode, pThisObject);
@@ -575,7 +574,7 @@
CFXJSE_Context* pVariableContext = it->second.get();
std::unique_ptr<CFXJSE_Value> pObject = pVariableContext->GetGlobalObject();
- auto hVariableValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto hVariableValue = std::make_unique<CFXJSE_Value>(GetIsolate());
if (!bGetter) {
pObject->SetObjectOwnProperty(szPropName, pValue);
return true;
@@ -597,7 +596,7 @@
void CFXJSE_Engine::RemoveBuiltInObjs(CFXJSE_Context* pContext) const {
const ByteStringView kObjNames[2] = {"Number", "Date"};
std::unique_ptr<CFXJSE_Value> pObject = pContext->GetGlobalObject();
- auto hProp = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto hProp = std::make_unique<CFXJSE_Value>(GetIsolate());
for (const auto& obj : kObjNames) {
if (pObject->GetObjectProperty(obj, hProp.get()))
pObject->DeleteObjectProperty(obj);
@@ -696,7 +695,7 @@
rndFind.m_ScriptAttribute.callback &&
nStart <
pdfium::base::checked_cast<int32_t>(wsExpression.GetLength())) {
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(GetIsolate());
CJX_Object* jsObject = rndFind.m_Objects.front()->JSObject();
(*rndFind.m_ScriptAttribute.callback)(
jsObject, pValue.get(), false, rndFind.m_ScriptAttribute.attribute);
@@ -783,7 +782,7 @@
if (iter != m_mapObjectToValue.end())
return iter->second.get();
- auto jsValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto jsValue = std::make_unique<CFXJSE_Value>(GetIsolate());
jsValue->SetHostObject(pObject, m_pJsClass.Get());
CFXJSE_Value* pValue = jsValue.get();
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 815c5a4..105fd69 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -20,7 +20,6 @@
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
#include "fxjs/xfa/cjx_object.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/crt/cfgas_decimal.h"
#include "xfa/fgas/crt/locale_iface.h"
@@ -1361,7 +1360,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
info.GetReturnValue().SetNull();
return;
@@ -1387,8 +1386,7 @@
uint32_t uCount = 0;
double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
- auto argValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
@@ -1398,19 +1396,19 @@
continue;
}
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength > 2) {
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectPropertyByIdx(1, propertyValue.get());
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
if (propertyValue->IsNull()) {
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
- auto defaultPropValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto defaultPropValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(jsObjectValue.get(), defaultPropValue.get());
if (defaultPropValue->IsNull())
continue;
@@ -1421,7 +1419,7 @@
} else {
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
jsObjectValue->GetObjectProperty(
propertyValue->ToString().AsStringView(), newPropertyValue.get());
if (newPropertyValue->IsNull())
@@ -1467,13 +1465,12 @@
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
int32_t iCount = 0;
for (int32_t i = 0; i < info.Length(); i++) {
- auto argValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
if (argValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
@@ -1482,9 +1479,9 @@
return;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectPropertyByIdx(1, propertyValue.get());
argValue->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -1503,7 +1500,7 @@
}
}
} else if (argValue->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(argValue.get(), newPropertyValue.get());
if (!newPropertyValue->IsNull())
iCount++;
@@ -1541,13 +1538,12 @@
uint32_t uCount = 0;
double dMaxValue = 0.0;
for (int32_t i = 0; i < info.Length(); i++) {
- auto argValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
if (argValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength <= 2) {
@@ -1555,9 +1551,9 @@
return;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectPropertyByIdx(1, propertyValue.get());
argValue->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -1585,7 +1581,7 @@
}
}
} else if (argValue->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(argValue.get(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -1615,13 +1611,12 @@
uint32_t uCount = 0;
double dMinValue = 0.0;
for (int32_t i = 0; i < info.Length(); i++) {
- auto argValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
if (argValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength <= 2) {
@@ -1629,9 +1624,9 @@
return;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectPropertyByIdx(1, propertyValue.get());
argValue->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -1659,7 +1654,7 @@
}
}
} else if (argValue->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(argValue.get(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -1691,8 +1686,8 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- auto argTwo = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argTwo = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (argOne->IsNull() || argTwo->IsNull()) {
info.GetReturnValue().SetNull();
return;
@@ -1727,7 +1722,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argOne->IsNull()) {
info.GetReturnValue().SetNull();
return;
@@ -1742,7 +1737,7 @@
uint8_t uPrecision = 0;
if (argc > 1) {
- auto argTwo = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
+ auto argTwo = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (argTwo->IsNull()) {
info.GetReturnValue().SetNull();
return;
@@ -1777,13 +1772,12 @@
uint32_t uCount = 0;
double dSum = 0.0;
for (int32_t i = 0; i < argc; i++) {
- auto argValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[i]);
if (argValue->IsNull())
continue;
if (argValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength <= 2) {
@@ -1791,10 +1785,10 @@
return;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectPropertyByIdx(1, propertyValue.get());
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
if (propertyValue->IsNull()) {
for (int32_t j = 2; j < iLength; j++) {
argValue->GetObjectPropertyByIdx(j, jsObjectValue.get());
@@ -1818,7 +1812,7 @@
}
}
} else if (argValue->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(argValue.get(), newPropertyValue.get());
if (newPropertyValue->IsNull())
continue;
@@ -3024,7 +3018,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (ValueIsNull(pThis, argOne.get())) {
info.GetReturnValue().SetNull();
return;
@@ -3043,9 +3037,9 @@
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
while (!bFound && !bStopCounterFlags && (iArgIndex < argc)) {
auto argIndexValue =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[iArgIndex]);
+ std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[iArgIndex]);
if (argIndexValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argIndexValue->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength > 3)
@@ -3053,9 +3047,9 @@
iValueIndex += (iLength - 2);
if (iValueIndex >= iIndex) {
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
argIndexValue->GetObjectPropertyByIdx(1, propertyValue.get());
argIndexValue->GetObjectPropertyByIdx(
(iLength - 1) - (iValueIndex - iIndex), jsObjectValue.get());
@@ -3093,7 +3087,7 @@
ToFormCalcContext(pThis)->ThrowParamCountMismatchException(L"Exists");
return;
}
- auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto temp = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
info.GetReturnValue().Set(static_cast<int>(temp->IsObject()));
}
@@ -3217,7 +3211,7 @@
std::unique_ptr<CFXJSE_Context> pNewContext(
CFXJSE_Context::Create(pIsolate, nullptr, nullptr));
- auto returnValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto returnValue = std::make_unique<CFXJSE_Value>(pIsolate);
pNewContext->ExecuteScript(
FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).c_str(), returnValue.get(),
nullptr);
@@ -3236,7 +3230,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray() && !argOne->IsObject() && !argOne->IsBoolean() &&
!argOne->IsString() && !argOne->IsNull() && !argOne->IsNumber()) {
pContext->ThrowArgumentMismatchException();
@@ -3250,7 +3244,7 @@
std::vector<std::unique_ptr<CFXJSE_Value>> values;
for (int32_t i = 0; i < 3; i++)
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
int intVal = 3;
if (argOne->IsNull()) {
@@ -3259,13 +3253,13 @@
values[2]->SetNull();
} else if (argOne->IsArray()) {
#ifndef NDEBUG
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectProperty("length", lengthValue.get());
ASSERT(lengthValue->ToInteger() >= 3);
#endif
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectPropertyByIdx(1, propertyValue.get());
argOne->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (!propertyValue->IsNull() || jsObjectValue->IsNull()) {
@@ -3281,7 +3275,7 @@
values[0]->SetInteger(intVal);
values[1]->SetNull();
- auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto temp = std::make_unique<CFXJSE_Value>(info.GetIsolate());
temp->SetArray(values);
info.GetReturnValue().Set(temp->DirectGetValue());
}
@@ -4558,15 +4552,15 @@
return;
}
ByteStringView bsFuncName("asgn_val_op");
- auto lValue = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto lValue = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
std::unique_ptr<CFXJSE_Value> rValue = GetSimpleValue(pThis, info, 1);
if (lValue->IsArray()) {
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- auto leftLengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto leftLengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
lValue->GetObjectProperty("length", leftLengthValue.get());
int32_t iLeftLength = leftLengthValue->ToInteger();
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
lValue->GetObjectPropertyByIdx(1, propertyValue.get());
if (propertyValue->IsNull()) {
for (int32_t i = 2; i < iLeftLength; i++) {
@@ -4704,21 +4698,21 @@
bool CFXJSE_FormCalcContext::fm_ref_equal(
CFXJSE_HostObject* pThis,
const v8::FunctionCallbackInfo<v8::Value>& info) {
- auto argFirst = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- auto argSecond = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
+ auto argFirst = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argSecond = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (!argFirst->IsArray() || !argSecond->IsArray())
return false;
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
- auto firstFlagValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto secondFlagValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto firstFlagValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto secondFlagValue = std::make_unique<CFXJSE_Value>(pIsolate);
argFirst->GetObjectPropertyByIdx(0, firstFlagValue.get());
argSecond->GetObjectPropertyByIdx(0, secondFlagValue.get());
if (firstFlagValue->ToInteger() != 3 || secondFlagValue->ToInteger() != 3)
return false;
- auto firstJSObject = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto secondJSObject = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto firstJSObject = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto secondJSObject = std::make_unique<CFXJSE_Value>(pIsolate);
argFirst->GetObjectPropertyByIdx(2, firstJSObject.get());
argSecond->GetObjectPropertyByIdx(2, secondJSObject.get());
if (firstJSObject->IsNull() || secondJSObject->IsNull())
@@ -4850,8 +4844,8 @@
return;
}
- auto argFirst = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
- auto argSecond = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[1]);
+ auto argFirst = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argSecond = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[1]);
if (ValueIsNull(pThis, argFirst.get()) &&
ValueIsNull(pThis, argSecond.get())) {
info.GetReturnValue().SetNull();
@@ -5037,7 +5031,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
info.GetReturnValue().Set(argOne->IsObject());
}
@@ -5050,7 +5044,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
info.GetReturnValue().Set(argOne->IsArray());
}
@@ -5064,21 +5058,21 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argOne->IsArray()) {
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectPropertyByIdx(1, propertyValue.get());
argOne->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
GetObjectDefaultValue(jsObjectValue.get(), pReturn.get());
info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
}
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
pReturn.get());
info.GetReturnValue().Set(pReturn->DirectGetValue());
@@ -5086,7 +5080,7 @@
}
if (argOne->IsObject()) {
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
GetObjectDefaultValue(argOne.get(), pReturn.get());
info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
@@ -5104,7 +5098,7 @@
return;
}
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
info.GetReturnValue().Set(argOne->DirectGetValue());
return;
@@ -5113,12 +5107,12 @@
#ifndef NDEBUG
CFXJSE_FormCalcContext* pContext = ToFormCalcContext(pThis);
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectProperty("length", lengthValue.get());
ASSERT(lengthValue->ToInteger() >= 3);
#endif
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
argOne->GetObjectPropertyByIdx(2, pReturn.get());
info.GetReturnValue().Set(pReturn->DirectGetValue());
}
@@ -5134,7 +5128,7 @@
}
v8::Isolate* pIsolate = pContext->GetScriptRuntime();
- auto argOne = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argOne = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (!argOne->IsArray()) {
std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, info, 0);
info.GetReturnValue().Set(simpleValue->DirectGetValue());
@@ -5142,12 +5136,12 @@
}
#ifndef NDEBUG
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectProperty("length", lengthValue.get());
ASSERT(lengthValue->ToInteger() >= 3);
#endif
- auto flagsValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto flagsValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectPropertyByIdx(0, flagsValue.get());
int32_t iFlags = flagsValue->ToInteger();
if (iFlags != 3 && iFlags != 4) {
@@ -5159,18 +5153,18 @@
if (iFlags == 4) {
std::vector<std::unique_ptr<CFXJSE_Value>> values;
for (int32_t i = 0; i < 3; i++)
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
values[0]->SetInteger(3);
values[1]->SetNull();
values[2]->SetNull();
- auto pResult = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pResult = std::make_unique<CFXJSE_Value>(info.GetIsolate());
pResult->SetArray(values);
info.GetReturnValue().Set(pResult->DirectGetValue());
return;
}
- auto objectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto objectValue = std::make_unique<CFXJSE_Value>(pIsolate);
argOne->GetObjectPropertyByIdx(2, objectValue.get());
if (objectValue->IsNull()) {
pContext->ThrowCompilerErrorException();
@@ -5186,20 +5180,20 @@
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
std::vector<std::unique_ptr<CFXJSE_Value>> returnValues;
for (int32_t i = 0; i < info.Length(); ++i) {
- auto argValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate, info[i]);
+ auto argValue = std::make_unique<CFXJSE_Value>(pIsolate, info[i]);
if (argValue->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argValue->GetObjectProperty("length", lengthValue.get());
int32_t length = lengthValue->ToInteger();
for (int32_t j = 2; j < length; j++) {
- returnValues.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ returnValues.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
argValue->GetObjectPropertyByIdx(j, returnValues.back().get());
}
}
- returnValues.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ returnValues.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
returnValues.back()->Assign(argValue.get());
}
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
pReturn->SetArray(returnValues);
info.GetReturnValue().Set(pReturn->DirectGetValue());
}
@@ -5213,22 +5207,22 @@
ASSERT(index < (uint32_t)info.Length());
auto argIndex =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[index]);
+ std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[index]);
if (!argIndex->IsArray() && !argIndex->IsObject())
return argIndex;
if (argIndex->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argIndex->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
- auto simpleValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto simpleValue = std::make_unique<CFXJSE_Value>(pIsolate);
if (iLength < 3) {
simpleValue.get()->SetUndefined();
return simpleValue;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
argIndex->GetObjectPropertyByIdx(1, propertyValue.get());
argIndex->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -5241,7 +5235,7 @@
return simpleValue;
}
- auto defaultValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto defaultValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(argIndex.get(), defaultValue.get());
return defaultValue;
}
@@ -5261,23 +5255,23 @@
if (iLength < 3)
return true;
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectPropertyByIdx(1, propertyValue.get());
arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
- auto defaultValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto defaultValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(jsObjectValue.get(), defaultValue.get());
return defaultValue->IsNull();
}
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return newPropertyValue->IsNull();
}
- auto defaultValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto defaultValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(arg, defaultValue.get());
return defaultValue->IsNull();
}
@@ -5290,7 +5284,7 @@
return 0;
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectProperty("length", lengthValue.get());
return lengthValue->ToInteger();
}
@@ -5325,21 +5319,21 @@
std::vector<std::unique_ptr<CFXJSE_Value>> results;
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
for (int32_t i = 1; i < info.Length(); ++i) {
- auto arg = pdfium::MakeUnique<CFXJSE_Value>(pIsolate, info[i]);
+ auto arg = std::make_unique<CFXJSE_Value>(pIsolate, info[i]);
if (arg->IsArray()) {
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength < 3)
continue;
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectPropertyByIdx(1, propertyValue.get());
for (int32_t j = 2; j < iLength; j++) {
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectPropertyByIdx(j, jsObjectValue.get());
- results.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ results.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
if (propertyValue->IsNull()) {
GetObjectDefaultValue(jsObjectValue.get(), results.back().get());
} else {
@@ -5348,10 +5342,10 @@
}
}
} else if (arg->IsObject()) {
- results.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ results.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
GetObjectDefaultValue(arg.get(), results.back().get());
} else {
- results.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ results.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
results.back()->Assign(arg.get());
}
}
@@ -5482,7 +5476,7 @@
*bAttribute = false;
CFXJSE_Engine* pScriptContext = pContext->GetDocument()->GetScriptContext();
for (auto& pObject : resolveNodeRS.objects) {
- resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ resultValues->push_back(std::make_unique<CFXJSE_Value>(pIsolate));
resultValues->back()->Assign(
pScriptContext->GetOrCreateJSBindingFromMap(pObject.Get()));
}
@@ -5493,7 +5487,7 @@
if (resolveNodeRS.script_attribute.callback &&
resolveNodeRS.script_attribute.eValueType == XFA_ScriptType::Object) {
for (auto& pObject : resolveNodeRS.objects) {
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto pValue = std::make_unique<CFXJSE_Value>(pIsolate);
CJX_Object* jsObject = pObject->JSObject();
(*resolveNodeRS.script_attribute.callback)(
jsObject, pValue.get(), false,
@@ -5507,7 +5501,7 @@
if (!pParentValue || !pParentValue->IsObject())
return;
- resultValues->push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ resultValues->push_back(std::make_unique<CFXJSE_Value>(pIsolate));
resultValues->back()->Assign(pParentValue);
}
@@ -5519,9 +5513,9 @@
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
if (pValue->IsArray()) {
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
pValue->GetObjectPropertyByIdx(1, propertyValue.get());
pValue->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -5534,7 +5528,7 @@
return ValueToInteger(pThis, newPropertyValue.get());
}
if (pValue->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(pValue, newPropertyValue.get());
return ValueToInteger(pThis, newPropertyValue.get());
}
@@ -5551,9 +5545,9 @@
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
if (arg->IsArray()) {
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectPropertyByIdx(1, propertyValue.get());
arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -5565,7 +5559,7 @@
return ValueToFloat(pThis, newPropertyValue.get());
}
if (arg->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(arg, newPropertyValue.get());
return ValueToFloat(pThis, newPropertyValue.get());
}
@@ -5584,9 +5578,9 @@
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
if (arg->IsArray()) {
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
arg->GetObjectPropertyByIdx(1, propertyValue.get());
arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull()) {
@@ -5598,7 +5592,7 @@
return ValueToDouble(pThis, newPropertyValue.get());
}
if (arg->IsObject()) {
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
GetObjectDefaultValue(arg, newPropertyValue.get());
return ValueToDouble(pThis, newPropertyValue.get());
}
@@ -5623,7 +5617,7 @@
return ValueToDouble(pThis, src);
v8::Isolate* pIsolate = ToFormCalcContext(pThis)->GetScriptRuntime();
- auto lengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto lengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
src->GetObjectProperty("length", lengthValue.get());
int32_t iLength = lengthValue->ToInteger();
if (iLength <= 2) {
@@ -5631,14 +5625,14 @@
return 0.0;
}
- auto propertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
- auto jsObjectValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto propertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
+ auto jsObjectValue = std::make_unique<CFXJSE_Value>(pIsolate);
src->GetObjectPropertyByIdx(1, propertyValue.get());
src->GetObjectPropertyByIdx(2, jsObjectValue.get());
if (propertyValue->IsNull())
return ValueToDouble(pThis, jsObjectValue.get());
- auto newPropertyValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto newPropertyValue = std::make_unique<CFXJSE_Value>(pIsolate);
jsObjectValue->GetObjectProperty(propertyValue->ToString().AsStringView(),
newPropertyValue.get());
return ValueToDouble(pThis, newPropertyValue.get());
@@ -5677,7 +5671,7 @@
CFXJSE_Context* pScriptContext,
CXFA_Document* pDoc)
: m_pIsolate(pScriptIsolate),
- m_pValue(pdfium::MakeUnique<CFXJSE_Value>(pScriptIsolate)),
+ m_pValue(std::make_unique<CFXJSE_Value>(pScriptIsolate)),
m_pDocument(pDoc) {
m_pValue->SetHostObject(
this,
@@ -5711,7 +5705,7 @@
int32_t iIndexValue = 0;
if (argc > 4) {
bIsStar = false;
- auto temp = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[4]);
+ auto temp = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[4]);
iIndexValue = ValueToInteger(pThis, temp.get());
}
@@ -5723,10 +5717,9 @@
fxv8::ReentrantToInt32Helper(info.GetIsolate(), info[3]), iIndexValue,
bIsStar);
- auto argAccessor =
- pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate(), info[0]);
+ auto argAccessor = std::make_unique<CFXJSE_Value>(info.GetIsolate(), info[0]);
if (argAccessor->IsArray()) {
- auto pLengthValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto pLengthValue = std::make_unique<CFXJSE_Value>(pIsolate);
argAccessor->GetObjectProperty("length", pLengthValue.get());
int32_t iLength = pLengthValue->ToInteger();
if (iLength < 3) {
@@ -5734,7 +5727,7 @@
return;
}
- auto hJSObjValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
+ auto hJSObjValue = std::make_unique<CFXJSE_Value>(pIsolate);
std::vector<std::vector<std::unique_ptr<CFXJSE_Value>>> resolveValues(
iLength - 2);
bool bAttribute = false;
@@ -5757,9 +5750,9 @@
}
std::vector<std::unique_ptr<CFXJSE_Value>> values;
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
values.back()->SetInteger(1);
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
if (bAttribute)
values.back()->SetString(bsName.AsStringView());
else
@@ -5767,11 +5760,11 @@
for (int32_t i = 0; i < iLength - 2; i++) {
for (size_t j = 0; j < resolveValues[i].size(); j++) {
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
values.back()->Assign(resolveValues[i][j].get());
}
}
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
pReturn->SetArray(values);
info.GetReturnValue().Set(pReturn->DirectGetValue());
return;
@@ -5805,7 +5798,7 @@
std::vector<std::unique_ptr<CFXJSE_Value>> values;
for (size_t i = 0; i < resolveValues.size() + 2; i++)
- values.push_back(pdfium::MakeUnique<CFXJSE_Value>(pIsolate));
+ values.push_back(std::make_unique<CFXJSE_Value>(pIsolate));
values[0]->SetInteger(1);
if (bAttribute)
@@ -5816,7 +5809,7 @@
for (size_t i = 0; i < resolveValues.size(); i++)
values[i + 2]->Assign(resolveValues[i].get());
- auto pReturn = pdfium::MakeUnique<CFXJSE_Value>(info.GetIsolate());
+ auto pReturn = std::make_unique<CFXJSE_Value>(info.GetIsolate());
pReturn->SetArray(values);
info.GetReturnValue().Set(pReturn->DirectGetValue());
}
diff --git a/fxjs/xfa/cfxjse_resolveprocessor.cpp b/fxjs/xfa/cfxjse_resolveprocessor.cpp
index ec59df8..a906df9 100644
--- a/fxjs/xfa/cfxjse_resolveprocessor.cpp
+++ b/fxjs/xfa/cfxjse_resolveprocessor.cpp
@@ -14,7 +14,6 @@
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
#include "fxjs/xfa/cjx_object.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
@@ -42,8 +41,7 @@
wsExpression = wsCondition.Substr(2, wsCondition.GetLength() - 3);
for (size_t i = iFoundCount; i > 0; --i) {
- auto pRetValue =
- pdfium::MakeUnique<CFXJSE_Value>(pRnd->m_pSC->GetIsolate());
+ auto pRetValue = std::make_unique<CFXJSE_Value>(pRnd->m_pSC->GetIsolate());
bool bRet =
pRnd->m_pSC->RunScript(eLangType, wsExpression.AsStringView(),
pRetValue.get(), pRnd->m_Objects[i - 1].Get());
@@ -55,7 +53,7 @@
} // namespace
CFXJSE_ResolveProcessor::CFXJSE_ResolveProcessor()
- : m_pNodeHelper(pdfium::MakeUnique<CXFA_NodeHelper>()) {}
+ : m_pNodeHelper(std::make_unique<CXFA_NodeHelper>()) {}
CFXJSE_ResolveProcessor::~CFXJSE_ResolveProcessor() = default;
diff --git a/fxjs/xfa/cfxjse_value_embeddertest.cpp b/fxjs/xfa/cfxjse_value_embeddertest.cpp
index e9c39c1..e6ace2a 100644
--- a/fxjs/xfa/cfxjse_value_embeddertest.cpp
+++ b/fxjs/xfa/cfxjse_value_embeddertest.cpp
@@ -11,14 +11,13 @@
#include "fxjs/xfa/cfxjse_engine.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/xfa_js_embedder_test.h"
-#include "third_party/base/ptr_util.h"
class CFXJSE_ValueEmbedderTest : public XFAJSEmbedderTest {};
TEST_F(CFXJSE_ValueEmbedderTest, Empty) {
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(GetIsolate());
EXPECT_TRUE(pValue->IsEmpty());
EXPECT_FALSE(pValue->IsUndefined());
EXPECT_FALSE(pValue->IsNull());
@@ -34,7 +33,7 @@
ASSERT_TRUE(OpenDocument("simple_xfa.pdf"));
// Test inserting empty values into arrays.
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(GetIsolate());
std::vector<std::unique_ptr<CFXJSE_Value>> vec;
vec.push_back(std::move(pValue));
diff --git a/fxjs/xfa/cjx_layoutpseudomodel.cpp b/fxjs/xfa/cjx_layoutpseudomodel.cpp
index 493f7e3..9d11113 100644
--- a/fxjs/xfa/cjx_layoutpseudomodel.cpp
+++ b/fxjs/xfa/cjx_layoutpseudomodel.cpp
@@ -6,6 +6,7 @@
#include "fxjs/xfa/cjx_layoutpseudomodel.h"
+#include <memory>
#include <set>
#include <utility>
@@ -14,7 +15,6 @@
#include "fxjs/xfa/cfxjse_class.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/layout/cxfa_contentlayoutitem.h"
@@ -370,7 +370,7 @@
return CJS_Result::Success();
auto* pDocLayout = CXFA_LayoutProcessor::FromDocument(GetDocument());
- auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(GetDocument());
+ auto pArrayNodeList = std::make_unique<CXFA_ArrayNodeList>(GetDocument());
pArrayNodeList->SetArrayNodeList(
GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea));
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp
index 3877f72..56a9035 100644
--- a/fxjs/xfa/cjx_node.cpp
+++ b/fxjs/xfa/cjx_node.cpp
@@ -17,7 +17,6 @@
#include "fxjs/js_resources.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
@@ -269,7 +268,7 @@
if (params.size() >= 3)
bOverwrite = runtime->ToBoolean(params[2]);
- auto pParser = pdfium::MakeUnique<CXFA_DocumentParser>(GetDocument());
+ auto pParser = std::make_unique<CXFA_DocumentParser>(GetDocument());
CFX_XMLNode* pXMLNode = pParser->ParseXMLData(expression);
if (!pXMLNode)
return CJS_Result::Success();
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 9aaeaad..9e152d3 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -21,7 +21,6 @@
#include "fxjs/xfa/cjx_field.h"
#include "fxjs/xfa/cjx_instancemanager.h"
#include "third_party/base/compiler_specific.h"
-#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fgas/crt/cfgas_decimal.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
@@ -820,7 +819,7 @@
XFA_MAPMODULEDATA* CJX_Object::CreateMapModuleData() {
if (!map_module_data_)
- map_module_data_ = pdfium::MakeUnique<XFA_MAPMODULEDATA>();
+ map_module_data_ = std::make_unique<XFA_MAPMODULEDATA>();
return map_module_data_.get();
}
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index cc13b7a..fe25906 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -6,12 +6,12 @@
#include "fxjs/xfa/cjx_tree.h"
+#include <memory>
#include <vector>
#include "fxjs/js_resources.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
-#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
#include "xfa/fxfa/parser/cxfa_attachnodelist.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -69,7 +69,7 @@
return CJS_Result::Success(runtime->NewNull());
}
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(pScriptContext->GetIsolate());
CJX_Object* jsObject = resolveNodeRS.objects.front()->JSObject();
(*resolveNodeRS.script_attribute.callback)(
jsObject, pValue.get(), false, resolveNodeRS.script_attribute.attribute);
@@ -88,7 +88,7 @@
refNode = GetDocument()->GetScriptContext()->GetThisObject();
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
- auto pValue = pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate());
+ auto pValue = std::make_unique<CFXJSE_Value>(pScriptContext->GetIsolate());
ResolveNodeList(pValue.get(), runtime->ToWideString(params[0]),
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent |
@@ -218,7 +218,7 @@
resolveNodeRS.script_attribute.eValueType == XFA_ScriptType::Object) {
for (auto& pObject : resolveNodeRS.objects) {
auto innerValue =
- pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate());
+ std::make_unique<CFXJSE_Value>(pScriptContext->GetIsolate());
CJX_Object* jsObject = pObject->JSObject();
(*resolveNodeRS.script_attribute.callback)(
jsObject, innerValue.get(), false,