Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: fpdfsdk/src/javascript/Document.cpp

Issue 1389163007: Pass IJS_Runtime, not IJS_Context, to native object constructors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Merge changes into stub. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/Document.h ('k') | fpdfsdk/src/javascript/Field.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/Document.cpp
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 7c1f5775d2e444014876be9b4614d6f5eb608a22..24f55b03f91e350a0703cb5adbccfc101fb1e830 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -140,17 +140,12 @@ END_JS_STATIC_METHOD()
IMPLEMENT_JS_CLASS(CJS_Document, Document)
-FX_BOOL CJS_Document::InitInstance(IJS_Context* cc) {
- CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
-
- Document* pDoc = (Document*)GetEmbedObject();
- ASSERT(pDoc != NULL);
-
- pDoc->AttachDoc(pContext->GetReaderDocument());
- pDoc->SetIsolate(pContext->GetJSRuntime()->GetIsolate());
- return TRUE;
-};
+void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) {
+ CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime);
+ Document* pDoc = static_cast<Document*>(GetEmbedObject());
+ pDoc->AttachDoc(pRuntime->GetReaderDocument());
+ pDoc->SetIsolate(pRuntime->GetIsolate());
+}
/* --------------------------------- Document ---------------------------------
*/
@@ -326,7 +321,7 @@ FX_BOOL Document::getField(IJS_Context* cc,
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext, CJS_Field::g_nObjDefnID);
+ pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID);
v8::Isolate* isolate = GetIsolate(cc);
CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(isolate, pFieldObj);
@@ -835,7 +830,7 @@ FX_BOOL Document::info(IJS_Context* cc,
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
v8::Local<v8::Object> pObj =
- FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, -1);
+ FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pRuntime, -1);
FXJS_PutObjectString(isolate, pObj, L"Author", cwAuthor.c_str());
FXJS_PutObjectString(isolate, pObj, L"Title", cwTitle.c_str());
FXJS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str());
@@ -1394,7 +1389,6 @@ FX_BOOL Document::icons(IJS_Context* cc,
return TRUE;
}
- CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array Icons(pRuntime);
IconElement* pIconElement = NULL;
@@ -1403,7 +1397,7 @@ FX_BOOL Document::icons(IJS_Context* cc,
pIconElement = (*m_pIconTree)[i];
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID);
+ pRuntime->GetIsolate(), pRuntime, CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
return FALSE;
@@ -1446,7 +1440,7 @@ FX_BOOL Document::getIcon(IJS_Context* cc,
Icon* pRetIcon = (*m_pIconTree)[i]->IconStream;
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID);
+ pRuntime->GetIsolate(), pRuntime, CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
return FALSE;
@@ -1642,7 +1636,7 @@ FX_BOOL Document::getPrintParams(IJS_Context* cc,
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID);
+ pRuntime->GetIsolate(), pRuntime, CJS_PrintParamsObj::g_nObjDefnID);
// Not implemented yet.
« no previous file with comments | « fpdfsdk/src/javascript/Document.h ('k') | fpdfsdk/src/javascript/Field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698