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

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

Issue 1382263002: Store object definition ID in each js_class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use size_t vars with FX_ArraySize. 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 748aad3a155ebb5d6cb63d83698f709e4930b3a3..d31bdc4a4e6079f4b248c1fb70c9b393f0fa0dc2 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -325,9 +325,8 @@ FX_BOOL Document::getField(IFXJS_Context* cc,
}
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- v8::Local<v8::Object> pFieldObj =
- FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext,
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
+ v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj(
+ pRuntime->GetIsolate(), pContext, CJS_Field::g_nObjDefnID);
v8::Isolate* isolate = GetIsolate(cc);
CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(isolate, pFieldObj);
@@ -441,11 +440,6 @@ FX_BOOL Document::print(IFXJS_Context* cc,
const CJS_Parameters& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
- CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
-
FX_BOOL bUI = TRUE;
int nStart = 0;
int nEnd = 0;
@@ -460,8 +454,7 @@ FX_BOOL Document::print(IFXJS_Context* cc,
if (params[8].GetType() == CJS_Value::VT_fxobject) {
v8::Local<v8::Object> pObj = params[8].ToV8Object();
{
- if (FXJS_GetObjDefnID(pObj) ==
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj")) {
+ if (FXJS_GetObjDefnID(pObj) == CJS_PrintParamsObj::g_nObjDefnID) {
if (CJS_Object* pJSObj = params[8].ToCJSObject()) {
if (PrintParamsObj* pprintparamsObj =
(PrintParamsObj*)pJSObj->GetEmbedObject()) {
@@ -1371,11 +1364,9 @@ FX_BOOL Document::addIcon(IFXJS_Context* cc,
sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR);
return FALSE;
}
- v8::Local<v8::Object> pJSIcon = params[1].ToV8Object();
- CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- if (FXJS_GetObjDefnID(pJSIcon) !=
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")) {
+ v8::Local<v8::Object> pJSIcon = params[1].ToV8Object();
+ if (FXJS_GetObjDefnID(pJSIcon) != CJS_Icon::g_nObjDefnID) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR);
return FALSE;
}
@@ -1423,8 +1414,7 @@ FX_BOOL Document::icons(IFXJS_Context* cc,
pIconElement = (*m_pIconTree)[i];
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext,
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon"));
+ pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
return FALSE;
@@ -1467,8 +1457,7 @@ FX_BOOL Document::getIcon(IFXJS_Context* cc,
Icon* pRetIcon = (*m_pIconTree)[i]->IconStream;
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext,
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon"));
+ pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
return FALSE;
@@ -1664,8 +1653,7 @@ FX_BOOL Document::getPrintParams(IFXJS_Context* cc,
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj(
- pRuntime->GetIsolate(), pContext,
- FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj"));
+ pRuntime->GetIsolate(), pContext, 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