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

Unified Diff: xfa/fxjse/context.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 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 | « xfa/fxjse/class.cpp ('k') | xfa/fxjse/dynprop.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxjse/context.cpp
diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp
index 75be76d6730724743d0fe8d6757667840ee5e2d2..572325d420259407cf6a6220615d28816e2d25ec 100644
--- a/xfa/fxjse/context.cpp
+++ b/xfa/fxjse/context.cpp
@@ -159,7 +159,7 @@ CFXJSE_Context* CFXJSE_Context::Create(
CFXJSE_HostObject* lpGlobalObject) {
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
CFXJSE_Context* pContext = new CFXJSE_Context(pIsolate);
- CFXJSE_Class* lpGlobalClassObj = NULL;
+ CFXJSE_Class* lpGlobalClassObj = nullptr;
v8::Local<v8::ObjectTemplate> hObjectTemplate;
if (lpGlobalClass) {
lpGlobalClassObj = CFXJSE_Class::Create(pContext, lpGlobalClass, TRUE);
@@ -173,7 +173,7 @@ CFXJSE_Context* CFXJSE_Context::Create(
hObjectTemplate->SetInternalFieldCount(1);
}
v8::Local<v8::Context> hNewContext =
- v8::Context::New(pIsolate, NULL, hObjectTemplate);
+ v8::Context::New(pIsolate, nullptr, hObjectTemplate);
v8::Local<v8::Context> hRootContext = v8::Local<v8::Context>::New(
pIsolate, CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext);
hNewContext->SetSecurityToken(hRootContext->GetSecurityToken());
@@ -203,7 +203,7 @@ FX_BOOL CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
v8::TryCatch trycatch(m_pIsolate);
v8::Local<v8::String> hScriptString =
v8::String::NewFromUtf8(m_pIsolate, szScript);
- if (lpNewThisObject == NULL) {
+ if (!lpNewThisObject) {
v8::Local<v8::Script> hScript = v8::Script::Compile(hScriptString);
if (!trycatch.HasCaught()) {
v8::Local<v8::Value> hValue = hScript->Run();
@@ -219,31 +219,30 @@ FX_BOOL CFXJSE_Context::ExecuteScript(const FX_CHAR* szScript,
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>();
+ }
+
+ 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;
}
« no previous file with comments | « xfa/fxjse/class.cpp ('k') | xfa/fxjse/dynprop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698