summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_context.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-03 06:10:26 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-03 06:10:26 -0700
commit304bb91238d6909cb5e170f8fc483aa7862558d5 (patch)
tree5183cddcd2bf05354c5cb424e18f57eb56780dea /fxjs/cfxjse_context.cpp
parentd19e912dd469e4bdad9f3020e1f6eb98f10f3470 (diff)
downloadpdfium-304bb91238d6909cb5e170f8fc483aa7862558d5.tar.xz
Remove FX_BOOL entirely.
FX_BOOL was a type just like a regular C++ bool, except that it took 4x the space and frequently was used to hold values besides true or false. Review-Url: https://codereview.chromium.org/2471353002
Diffstat (limited to 'fxjs/cfxjse_context.cpp')
-rw-r--r--fxjs/cfxjse_context.cpp61
1 files changed, 29 insertions, 32 deletions
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 93efc4f12c..d82f875e0f 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -156,7 +156,7 @@ CFXJSE_Context* CFXJSE_Context::Create(
CFXJSE_Class* lpGlobalClassObj = nullptr;
v8::Local<v8::ObjectTemplate> hObjectTemplate;
if (lpGlobalClass) {
- lpGlobalClassObj = CFXJSE_Class::Create(pContext, lpGlobalClass, TRUE);
+ lpGlobalClassObj = CFXJSE_Class::Create(pContext, lpGlobalClass, true);
ASSERT(lpGlobalClassObj);
v8::Local<v8::FunctionTemplate> hFunctionTemplate =
v8::Local<v8::FunctionTemplate>::New(pIsolate,
@@ -202,9 +202,9 @@ void CFXJSE_Context::EnableCompatibleMode() {
ExecuteScript(szCompatibleModeScript, nullptr, nullptr);
}
-FX_BOOL CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
- CFXJSE_Value* lpRetValue,
- CFXJSE_Value* lpNewThisObject) {
+bool CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
+ CFXJSE_Value* lpRetValue,
+ CFXJSE_Value* lpNewThisObject) {
CFXJSE_ScopeUtil_IsolateHandleContext scope(this);
v8::TryCatch trycatch(m_pIsolate);
v8::Local<v8::String> hScriptString =
@@ -214,42 +214,39 @@ FX_BOOL CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
if (!trycatch.HasCaught()) {
v8::Local<v8::Value> hValue = hScript->Run();
if (!trycatch.HasCaught()) {
- if (lpRetValue) {
+ if (lpRetValue)
lpRetValue->m_hValue.Reset(m_pIsolate, hValue);
- }
- return TRUE;
+ return true;
}
}
if (lpRetValue) {
lpRetValue->m_hValue.Reset(m_pIsolate,
FXJSE_CreateReturnValue(m_pIsolate, trycatch));
}
- return FALSE;
- } else {
- v8::Local<v8::Value> hNewThis =
- v8::Local<v8::Value>::New(m_pIsolate, lpNewThisObject->m_hValue);
- ASSERT(!hNewThis.IsEmpty());
- v8::Local<v8::Script> hWrapper =
- v8::Script::Compile(v8::String::NewFromUtf8(
- m_pIsolate, "(function () { return eval(arguments[0]); })"));
- v8::Local<v8::Value> hWrapperValue = hWrapper->Run();
- ASSERT(hWrapperValue->IsFunction());
- v8::Local<v8::Function> hWrapperFn = hWrapperValue.As<v8::Function>();
+ return false;
+ }
+
+ v8::Local<v8::Value> hNewThis =
+ v8::Local<v8::Value>::New(m_pIsolate, lpNewThisObject->m_hValue);
+ ASSERT(!hNewThis.IsEmpty());
+ v8::Local<v8::Script> hWrapper = v8::Script::Compile(v8::String::NewFromUtf8(
+ m_pIsolate, "(function () { return eval(arguments[0]); })"));
+ v8::Local<v8::Value> hWrapperValue = hWrapper->Run();
+ ASSERT(hWrapperValue->IsFunction());
+ v8::Local<v8::Function> hWrapperFn = hWrapperValue.As<v8::Function>();
+ if (!trycatch.HasCaught()) {
+ v8::Local<v8::Value> rgArgs[] = {hScriptString};
+ v8::Local<v8::Value> hValue =
+ hWrapperFn->Call(hNewThis.As<v8::Object>(), 1, rgArgs);
if (!trycatch.HasCaught()) {
- v8::Local<v8::Value> rgArgs[] = {hScriptString};
- v8::Local<v8::Value> hValue =
- hWrapperFn->Call(hNewThis.As<v8::Object>(), 1, rgArgs);
- if (!trycatch.HasCaught()) {
- if (lpRetValue) {
- lpRetValue->m_hValue.Reset(m_pIsolate, hValue);
- }
- return TRUE;
- }
+ if (lpRetValue)
+ lpRetValue->m_hValue.Reset(m_pIsolate, hValue);
+ return true;
}
- if (lpRetValue) {
- lpRetValue->m_hValue.Reset(m_pIsolate,
- FXJSE_CreateReturnValue(m_pIsolate, trycatch));
- }
- return FALSE;
}
+ if (lpRetValue) {
+ lpRetValue->m_hValue.Reset(m_pIsolate,
+ FXJSE_CreateReturnValue(m_pIsolate, trycatch));
+ }
+ return false;
}