summaryrefslogtreecommitdiff
path: root/fxjs/cjs_global.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-17 19:28:52 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-17 19:28:52 +0000
commit3a6d058740a9908a06efb9e9362df01acdee6ff8 (patch)
tree9bc645b0cb3442749458fc63e2feb04c0cb813ef /fxjs/cjs_global.cpp
parent0a2328e0eff7a11aa49b7da8f013e658153a7b1a (diff)
downloadpdfium-3a6d058740a9908a06efb9e9362df01acdee6ff8.tar.xz
Rename CJS_Return to CJS_Result.
"Return" is a verb, and "return" is a reserved-word at that, so avoid using it as part of a class name. Fully mechanical change apart from rename. Change-Id: I120e453e8ba001c4ab74a39e2da6aa6eb590835f Reviewed-on: https://pdfium-review.googlesource.com/40532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_global.cpp')
-rw-r--r--fxjs/cjs_global.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp
index e747d6205c..ea8694fe14 100644
--- a/fxjs/cjs_global.cpp
+++ b/fxjs/cjs_global.cpp
@@ -40,7 +40,7 @@ void JSSpecialPropQuery(const char*,
if (!pRuntime)
return;
- CJS_Return result =
+ CJS_Result result =
pObj->QueryProperty(PropFromV8Prop(info.GetIsolate(), property).c_str());
info.GetReturnValue().Set(!result.HasError() ? 4 : 0);
@@ -58,7 +58,7 @@ void JSSpecialPropGet(const char* class_name,
if (!pRuntime)
return;
- CJS_Return result = pObj->GetProperty(
+ CJS_Result result = pObj->GetProperty(
pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str());
if (result.HasError()) {
@@ -83,7 +83,7 @@ void JSSpecialPropPut(const char* class_name,
if (!pRuntime)
return;
- CJS_Return result = pObj->SetProperty(
+ CJS_Result result = pObj->SetProperty(
pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str(), value);
if (result.HasError()) {
@@ -104,7 +104,7 @@ void JSSpecialPropDel(const char* class_name,
if (!pRuntime)
return;
- CJS_Return result = pObj->DelProperty(
+ CJS_Result result = pObj->DelProperty(
pRuntime, PropFromV8Prop(info.GetIsolate(), property).c_str());
if (result.HasError()) {
// TODO(dsinclair): Should this set the pRuntime->Error result?
@@ -224,52 +224,52 @@ void CJS_Global::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
UpdateGlobalPersistentVariables();
}
-CJS_Return CJS_Global::QueryProperty(const wchar_t* propname) {
+CJS_Result CJS_Global::QueryProperty(const wchar_t* propname) {
if (WideString(propname) != L"setPersistent")
- return CJS_Return::Failure(JSMessage::kUnknownProperty);
- return CJS_Return::Success();
+ return CJS_Result::Failure(JSMessage::kUnknownProperty);
+ return CJS_Result::Success();
}
-CJS_Return CJS_Global::DelProperty(CJS_Runtime* pRuntime,
+CJS_Result CJS_Global::DelProperty(CJS_Runtime* pRuntime,
const wchar_t* propname) {
auto it = m_MapGlobal.find(WideString(propname).ToDefANSI());
if (it == m_MapGlobal.end())
- return CJS_Return::Failure(JSMessage::kUnknownProperty);
+ return CJS_Result::Failure(JSMessage::kUnknownProperty);
it->second->bDeleted = true;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJS_Global::GetProperty(CJS_Runtime* pRuntime,
+CJS_Result CJS_Global::GetProperty(CJS_Runtime* pRuntime,
const wchar_t* propname) {
auto it = m_MapGlobal.find(WideString(propname).ToDefANSI());
if (it == m_MapGlobal.end())
- return CJS_Return::Success();
+ return CJS_Result::Success();
JSGlobalData* pData = it->second.get();
if (pData->bDeleted)
- return CJS_Return::Success();
+ return CJS_Result::Success();
switch (pData->nType) {
case JS_GlobalDataType::NUMBER:
- return CJS_Return::Success(pRuntime->NewNumber(pData->dData));
+ return CJS_Result::Success(pRuntime->NewNumber(pData->dData));
case JS_GlobalDataType::BOOLEAN:
- return CJS_Return::Success(pRuntime->NewBoolean(pData->bData));
+ return CJS_Result::Success(pRuntime->NewBoolean(pData->bData));
case JS_GlobalDataType::STRING:
- return CJS_Return::Success(pRuntime->NewString(
+ return CJS_Result::Success(pRuntime->NewString(
WideString::FromLocal(pData->sData.AsStringView()).AsStringView()));
case JS_GlobalDataType::OBJECT:
- return CJS_Return::Success(
+ return CJS_Result::Success(
v8::Local<v8::Object>::New(pRuntime->GetIsolate(), pData->pData));
case JS_GlobalDataType::NULLOBJ:
- return CJS_Return::Success(pRuntime->NewNull());
+ return CJS_Result::Success(pRuntime->NewNull());
default:
break;
}
- return CJS_Return::Failure(JSMessage::kObjectTypeError);
+ return CJS_Result::Failure(JSMessage::kObjectTypeError);
}
-CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime,
+CJS_Result CJS_Global::SetProperty(CJS_Runtime* pRuntime,
const wchar_t* propname,
v8::Local<v8::Value> vp) {
ByteString sPropName = WideString(propname).ToDefANSI();
@@ -298,23 +298,23 @@ CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime,
}
if (vp->IsUndefined()) {
DelProperty(pRuntime, propname);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
- return CJS_Return::Failure(JSMessage::kObjectTypeError);
+ return CJS_Result::Failure(JSMessage::kObjectTypeError);
}
-CJS_Return CJS_Global::setPersistent(
+CJS_Result CJS_Global::setPersistent(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
auto it = m_MapGlobal.find(pRuntime->ToWideString(params[0]).ToDefANSI());
if (it == m_MapGlobal.end() || it->second->bDeleted)
- return CJS_Return::Failure(JSMessage::kGlobalNotFoundError);
+ return CJS_Result::Failure(JSMessage::kGlobalNotFoundError);
it->second->bPersistent = pRuntime->ToBoolean(params[1]);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
void CJS_Global::UpdateGlobalPersistentVariables() {
@@ -497,7 +497,7 @@ void CJS_Global::DestroyGlobalPersisitentVariables() {
m_MapGlobal.clear();
}
-CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname,
+CJS_Result CJS_Global::SetGlobalVariables(const ByteString& propname,
JS_GlobalDataType nType,
double dData,
bool bData,
@@ -505,7 +505,7 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname,
v8::Local<v8::Object> pData,
bool bDefaultPersistent) {
if (propname.IsEmpty())
- return CJS_Return::Failure(JSMessage::kUnknownProperty);
+ return CJS_Result::Failure(JSMessage::kUnknownProperty);
auto it = m_MapGlobal.find(propname);
if (it != m_MapGlobal.end()) {
@@ -533,9 +533,9 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname,
case JS_GlobalDataType::NULLOBJ:
break;
default:
- return CJS_Return::Failure(JSMessage::kObjectTypeError);
+ return CJS_Result::Failure(JSMessage::kObjectTypeError);
}
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
auto pNewData = pdfium::MakeUnique<JSGlobalData>();
@@ -565,8 +565,8 @@ CJS_Return CJS_Global::SetGlobalVariables(const ByteString& propname,
pNewData->bPersistent = bDefaultPersistent;
break;
default:
- return CJS_Return::Failure(JSMessage::kObjectTypeError);
+ return CJS_Result::Failure(JSMessage::kObjectTypeError);
}
m_MapGlobal[propname] = std::move(pNewData);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}