summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cjs_runtime.cpp5
-rw-r--r--fxjs/cjs_runtimestub.cpp5
-rw-r--r--fxjs/ijs_runtime.h5
3 files changed, 10 insertions, 5 deletions
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index c8e95e16e5..919c5a9b66 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -57,8 +57,9 @@ void IJS_Runtime::Destroy() {
}
// static
-IJS_Runtime* IJS_Runtime::Create(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
- return new CJS_Runtime(pFormFillEnv);
+std::unique_ptr<IJS_Runtime> IJS_Runtime::Create(
+ CPDFSDK_FormFillEnvironment* pFormFillEnv) {
+ return pdfium::MakeUnique<CJS_Runtime>(pFormFillEnv);
}
// static
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp
index 919672832d..964b0ff9d6 100644
--- a/fxjs/cjs_runtimestub.cpp
+++ b/fxjs/cjs_runtimestub.cpp
@@ -55,6 +55,7 @@ void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {}
void IJS_Runtime::Destroy() {}
// static
-IJS_Runtime* IJS_Runtime::Create(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
- return new CJS_RuntimeStub(pFormFillEnv);
+std::unique_ptr<IJS_Runtime> IJS_Runtime::Create(
+ CPDFSDK_FormFillEnvironment* pFormFillEnv) {
+ return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv);
}
diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h
index e649aada0c..9fe5d2fed8 100644
--- a/fxjs/ijs_runtime.h
+++ b/fxjs/ijs_runtime.h
@@ -7,6 +7,8 @@
#ifndef FXJS_IJS_RUNTIME_H_
#define FXJS_IJS_RUNTIME_H_
+#include <memory>
+
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
@@ -22,7 +24,8 @@ class IJS_Runtime {
public:
static void Initialize(unsigned int slot, void* isolate);
static void Destroy();
- static IJS_Runtime* Create(CPDFSDK_FormFillEnvironment* pFormFillEnv);
+ static std::unique_ptr<IJS_Runtime> Create(
+ CPDFSDK_FormFillEnvironment* pFormFillEnv);
virtual ~IJS_Runtime() {}
virtual IJS_EventContext* NewEventContext() = 0;