summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-11 08:18:47 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-11 08:18:47 -0700
commitdf4de98c06075b0e491ac645f2d118a6813cedc9 (patch)
tree9b2f9b48477b061ade9534990384109587e23946 /fpdfsdk/src/javascript/JS_Runtime.cpp
parent89d8b4681ce98894a1ee1a6cf4bae77e00d28797 (diff)
downloadpdfium-df4de98c06075b0e491ac645f2d118a6813cedc9.tar.xz
Rename Init methods to more accurately describe purpose
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1335763002 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp65
1 files changed, 36 insertions, 29 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index e3b3ed0f49..5f4a473c87 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -113,7 +113,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
m_isolateManaged = true;
}
- InitJSObjects();
+ DefineJSObjects();
CJS_Context* pContext = (CJS_Context*)NewContext();
JS_InitialRuntime(GetIsolate(), this, pContext, m_context);
@@ -137,65 +137,72 @@ CJS_Runtime::~CJS_Runtime() {
m_isolate->Dispose();
}
-FX_BOOL CJS_Runtime::InitJSObjects() {
+FX_BOOL CJS_Runtime::DefineJSObjects() {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> 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;