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

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

Issue 1342433002: Fix strings, remove stringify macros, void return types for Consts.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Added tests Created 5 years, 3 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/Consts.cpp ('k') | fpdfsdk/src/javascript/global.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_Runtime.cpp
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 5f4a473c87107a4394c45087a0ac03388cf636e4..4b18d80f6c4bd6f02310b78f94bffe4040fc9ea8 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -137,7 +137,7 @@ CJS_Runtime::~CJS_Runtime() {
m_isolate->Dispose();
}
-FX_BOOL CJS_Runtime::DefineJSObjects() {
+void CJS_Runtime::DefineJSObjects() {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::HandleScope handle_scope(GetIsolate());
v8::Local<v8::Context> context = v8::Context::New(GetIsolate());
@@ -145,67 +145,43 @@ FX_BOOL CJS_Runtime::DefineJSObjects() {
// 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::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Font::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
+ CJS_Border::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Display::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Font::DefineJSObjects(GetIsolate(), JS_STATIC);
// ObjDefIDs 3 - 5
- if (CJS_Highlight::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Position::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_ScaleHow::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
+ CJS_Highlight::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Position::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_ScaleHow::DefineJSObjects(GetIsolate(), JS_STATIC);
// ObjDefIDs 6 - 8
- if (CJS_ScaleWhen::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Style::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Zoomtype::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
+ CJS_ScaleWhen::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Style::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Zoomtype::DefineJSObjects(GetIsolate(), JS_STATIC);
// ObjDefIDs 9 - 11
- if (CJS_App::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Color::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Console::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
+ CJS_App::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Color::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Console::DefineJSObjects(GetIsolate(), JS_STATIC);
// ObjDefIDs 12 - 14
- if (CJS_Document::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0)
- return FALSE;
- if (CJS_Event::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Field::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0)
- return FALSE;
+ CJS_Document::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
+ CJS_Event::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Field::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
// ObjDefIDs 15 - 17
- if (CJS_Global::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
- if (CJS_Icon::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0)
- return FALSE;
- if (CJS_Util::DefineJSObjects(GetIsolate(), JS_STATIC) < 0)
- return FALSE;
-
- // ObjDefIDs 18 - 20
- if (CJS_PublicMethods::DefineJSObjects(GetIsolate()) < 0)
- return FALSE;
- if (CJS_GlobalConsts::DefineJSObjects(GetIsolate()) < 0)
- return FALSE;
- if (CJS_GlobalArrays::DefineJSObjects(GetIsolate()) < 0)
- return FALSE;
-
- if (CJS_TimerObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0)
- return FALSE;
- if (CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC) < 0)
- return FALSE;
-
- return TRUE;
+ CJS_Global::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Icon::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
+ CJS_Util::DefineJSObjects(GetIsolate(), JS_STATIC);
+
+ // ObjDefIDs 18 - 20 (these can't fail, return void).
+ CJS_PublicMethods::DefineJSObjects(GetIsolate());
+ CJS_GlobalConsts::DefineJSObjects(GetIsolate());
+ CJS_GlobalArrays::DefineJSObjects(GetIsolate());
+
+ // ObjDefIDs 21 - 22.
+ CJS_TimerObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
+ CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
}
IFXJS_Context* CJS_Runtime::NewContext() {
« no previous file with comments | « fpdfsdk/src/javascript/Consts.cpp ('k') | fpdfsdk/src/javascript/global.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698