Remove CJS_Object::InitInstance().

Because constructors can do all this.

Change-Id: I4f7ff6c26b17d9bddd326333a66e1bd38b2ea377
Reviewed-on: https://pdfium-review.googlesource.com/34693
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index a259767..791e9bd 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -124,14 +124,12 @@
 }
 
 CJS_Document::CJS_Document(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
-    : CJS_Object(pObject, pRuntime) {}
-
-CJS_Document::~CJS_Document() = default;
-
-void CJS_Document::InitInstance() {
+    : CJS_Object(pObject, pRuntime) {
   SetFormFillEnv(GetRuntime()->GetFormFillEnv());
 }
 
+CJS_Document::~CJS_Document() = default;
+
 // The total number of fields in document.
 CJS_Return CJS_Document::get_num_fields(CJS_Runtime* pRuntime) {
   if (!m_pFormFillEnv)
diff --git a/fxjs/cjs_document.h b/fxjs/cjs_document.h
index 6727f4e..262d472 100644
--- a/fxjs/cjs_document.h
+++ b/fxjs/cjs_document.h
@@ -26,9 +26,6 @@
   CJS_Document(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
   ~CJS_Document() override;
 
-  // CJS_Object:
-  void InitInstance() override;
-
   void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
   CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
     return m_pFormFillEnv.Get();
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index 5d5bc3c..ffa30a5 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -200,17 +200,15 @@
 }
 
 CJS_Global::CJS_Global(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
-    : CJS_Object(pObject, pRuntime) {}
+    : CJS_Object(pObject, pRuntime) {
+  Initial(GetRuntime()->GetFormFillEnv());
+}
 
 CJS_Global::~CJS_Global() {
   DestroyGlobalPersisitentVariables();
   m_pGlobalData->Release();
 }
 
-void CJS_Global::InitInstance() {
-  Initial(GetRuntime()->GetFormFillEnv());
-}
-
 void CJS_Global::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
   m_pFormFillEnv.Reset(pFormFillEnv);
   m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pFormFillEnv);
diff --git a/fxjs/cjs_global.h b/fxjs/cjs_global.h
index e0d41b8..17a519e 100644
--- a/fxjs/cjs_global.h
+++ b/fxjs/cjs_global.h
@@ -38,9 +38,6 @@
   CJS_Global(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
   ~CJS_Global() override;
 
-  // CJS_Object:
-  void InitInstance() override;
-
   CJS_Return DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname);
   void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
 
diff --git a/fxjs/cjs_object.cpp b/fxjs/cjs_object.cpp
index 62fa421..36fcc74 100644
--- a/fxjs/cjs_object.cpp
+++ b/fxjs/cjs_object.cpp
@@ -46,5 +46,3 @@
       m_pRuntime(pRuntime) {}
 
 CJS_Object::~CJS_Object() {}
-
-void CJS_Object::InitInstance() {}
diff --git a/fxjs/cjs_object.h b/fxjs/cjs_object.h
index c33fd77..c3766fc 100644
--- a/fxjs/cjs_object.h
+++ b/fxjs/cjs_object.h
@@ -53,8 +53,6 @@
   CJS_Object(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
   virtual ~CJS_Object();
 
-  virtual void InitInstance();
-
   v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(GetIsolate()); }
   v8::Isolate* GetIsolate() const { return m_pIsolate.Get(); }
   CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); }
diff --git a/fxjs/js_define.h b/fxjs/js_define.h
index 93dfd49..0f16749 100644
--- a/fxjs/js_define.h
+++ b/fxjs/js_define.h
@@ -50,9 +50,8 @@
 
 template <class T>
 static void JSConstructor(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) {
-  auto pObj = pdfium::MakeUnique<T>(obj, static_cast<CJS_Runtime*>(pEngine));
-  pObj->InitInstance();
-  pEngine->SetObjectPrivate(obj, std::move(pObj));
+  pEngine->SetObjectPrivate(
+      obj, pdfium::MakeUnique<T>(obj, static_cast<CJS_Runtime*>(pEngine)));
 }
 
 // CJS_Object has vitual dtor, template not required.