From 570875c067ab1b4c81fac2cfe908f867d3979d3a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 11 Sep 2015 08:35:03 -0700 Subject: Merge to XFA: Rename Init methods to more accurately describe purpose (cherry picked from commit df4de98c06075b0e491ac645f2d118a6813cedc9) Trivial manual merges in fpdfsdk/include/javascript/JS_Runtime.h fpdfsdk/src/javascript/JS_Runtime.cpp Original Review URL: https://codereview.chromium.org/1335763002 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1334313002 . --- fpdfsdk/src/javascript/JS_Runtime.cpp | 65 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp') diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index 062dd25b29..95060ae4ac 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -130,7 +130,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) return; } - InitJSObjects(); + DefineJSObjects(); CJS_Context* pContext = (CJS_Context*)NewContext(); JS_InitialRuntime(GetIsolate(), this, pContext, m_context); @@ -156,66 +156,73 @@ CJS_Runtime::~CJS_Runtime() { m_isolate = NULL; } -FX_BOOL CJS_Runtime::InitJSObjects() { +FX_BOOL CJS_Runtime::DefineJSObjects() { v8::Isolate::Scope isolate_scope(GetIsolate()); v8::Locker locker(GetIsolate()); v8::HandleScope handle_scope(GetIsolate()); v8::Local context = v8::Context::New(GetIsolate()); v8::Context::Scope context_scope(context); - // 0 - 8 - if (CJS_Border::Init(GetIsolate(), JS_STATIC) < 0) + + // The call order determines the "ObjDefID" assigned to each class. + // ObjDefIDs 0 - 2 + if (CJS_Border::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Display::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Display::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Font::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Font::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Highlight::Init(GetIsolate(), JS_STATIC) < 0) + + // ObjDefIDs 3 - 5 + if (CJS_Highlight::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Position::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Position::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_ScaleHow::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_ScaleHow::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_ScaleWhen::Init(GetIsolate(), JS_STATIC) < 0) + + // ObjDefIDs 6 - 8 + if (CJS_ScaleWhen::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Style::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Style::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Zoomtype::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Zoomtype::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - // 9 - 11 - if (CJS_App::Init(GetIsolate(), JS_STATIC) < 0) + // ObjDefIDs 9 - 11 + if (CJS_App::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Color::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Color::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Console::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Console::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - // 12 - 14 - if (CJS_Document::Init(GetIsolate(), JS_DYNAMIC) < 0) + // ObjDefIDs 12 - 14 + if (CJS_Document::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0) return FALSE; - if (CJS_Event::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Event::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Field::Init(GetIsolate(), JS_DYNAMIC) < 0) + if (CJS_Field::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0) return FALSE; - // 15 - 17 - if (CJS_Global::Init(GetIsolate(), JS_STATIC) < 0) + // ObjDefIDs 15 - 17 + if (CJS_Global::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_Icon::Init(GetIsolate(), JS_DYNAMIC) < 0) + if (CJS_Icon::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0) return FALSE; - if (CJS_Util::Init(GetIsolate(), JS_STATIC) < 0) + if (CJS_Util::DefineJSObjects(GetIsolate(), JS_STATIC) < 0) return FALSE; - if (CJS_PublicMethods::Init(GetIsolate()) < 0) + // ObjDefIDs 18 - 20 + if (CJS_PublicMethods::DefineJSObjects(GetIsolate()) < 0) return FALSE; - if (CJS_GlobalConsts::Init(GetIsolate()) < 0) + if (CJS_GlobalConsts::DefineJSObjects(GetIsolate()) < 0) return FALSE; - if (CJS_GlobalArrays::Init(GetIsolate()) < 0) + if (CJS_GlobalArrays::DefineJSObjects(GetIsolate()) < 0) return FALSE; - if (CJS_TimerObj::Init(GetIsolate(), JS_DYNAMIC) < 0) + if (CJS_TimerObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0) return FALSE; - if (CJS_PrintParamsObj::Init(GetIsolate(), JS_DYNAMIC) < 0) + if (CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0) return FALSE; return TRUE; -- cgit v1.2.3