diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-05 21:43:19 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-05 21:43:19 +0000 |
commit | 998fee395fc8a543968c7db3db9e3cf81dee57fc (patch) | |
tree | c11024354ed996cee5cd5d463ab050e1e2c02d5d /fxjs/cjs_document.cpp | |
parent | 0729be26d745e2ea713908eb9040e2be7c40c96b (diff) | |
download | pdfium-998fee395fc8a543968c7db3db9e3cf81dee57fc.tar.xz |
Remove the CJS_EmbedObj template param from JSConstructor.
Each of the CJS_Objects can create their CJS_EmbedObj's internally and
we don't need to do it though the JSConstructor. This also removes the
need for the SetEmbedObj method in CJS_Object.
Change-Id: Ib0535ad922b370634fd1e622a04860a96c4f2825
Reviewed-on: https://pdfium-review.googlesource.com/25370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r-- | fxjs/cjs_document.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index e513ba0159..f8bdecda79 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -116,13 +116,17 @@ int CJS_Document::GetObjDefnID() { // static void CJS_Document::DefineJSObjects(CFXJS_Engine* pEngine) { - ObjDefnID = - pEngine->DefineObj("Document", FXJSOBJTYPE_GLOBAL, - JSConstructor<CJS_Document, Document>, JSDestructor); + ObjDefnID = pEngine->DefineObj("Document", FXJSOBJTYPE_GLOBAL, + JSConstructor<CJS_Document>, JSDestructor); DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs)); DefineMethods(pEngine, ObjDefnID, MethodSpecs, FX_ArraySize(MethodSpecs)); } +CJS_Document::CJS_Document(v8::Local<v8::Object> pObject) + : CJS_Object(pObject) { + m_pEmbedObj = pdfium::MakeUnique<Document>(this); +} + void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) { CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); Document* pDoc = static_cast<Document*>(GetEmbedObject()); @@ -135,7 +139,7 @@ Document::Document(CJS_Object* pJSObject) m_cwBaseURL(L""), m_bDelay(false) {} -Document::~Document() {} +Document::~Document() = default; // The total number of fields in document. CJS_Return Document::get_num_fields(CJS_Runtime* pRuntime) { |