diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-06 11:10:52 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-06 11:10:52 -0700 |
commit | f0a5b2803c09f3605dcd606e764ef604f0d2a8ea (patch) | |
tree | c70b0fd99702afbeb7474b7c168d13dc5d6831a3 /fpdfsdk/src/javascript/Field.cpp | |
parent | 4ea721cb7954898a9722c389dae86c62957352d0 (diff) | |
download | pdfium-f0a5b2803c09f3605dcd606e764ef604f0d2a8ea.tar.xz |
Store object definition ID in each js_class.
Avoids doing a lookup via FXJS_V8 for something already
known in CJS layer.
Also:
Consolidate repeated code in JS macros.
Remove knowledge that Document is global from FXJS layer
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1382263002 .
Diffstat (limited to 'fpdfsdk/src/javascript/Field.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/Field.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 7026530d72..973d912273 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -3310,9 +3310,8 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - v8::Local<v8::Object> pObj = - FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); + v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( + pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID); ASSERT(pObj.IsEmpty() == FALSE); CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); @@ -3521,9 +3520,8 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) { nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j)); v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( - pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); - ASSERT(pObj.IsEmpty() == FALSE); + pRuntime->GetIsolate(), pContext, CJS_Field::g_nObjDefnID); + ASSERT(!pObj.IsEmpty()); CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |