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

Unified Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 1342403005: Merge to XFA: Don't pass null isolates to FXJS_ when we have a real isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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/JS_Runtime.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/jsapi/fxjs_v8.cpp
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index 190641131a16f4dd6e574ebc8786bcd77c7077fe..6349ca3a6f084e699f628aa2e381b9afba37db05 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -497,13 +497,6 @@ const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj) {
return kFXJSValueNameUndefined;
return NULL;
}
-void FXJS_SetPrivate(v8::Local<v8::Object> pObj, void* p) {
- FXJS_SetPrivate(NULL, pObj, p);
-}
-
-void* FXJS_GetPrivate(v8::Local<v8::Object> pObj) {
- return FXJS_GetPrivate(NULL, pObj);
-}
void FXJS_SetPrivate(v8::Isolate* pIsolate,
v8::Local<v8::Object> pObj,
@@ -519,24 +512,21 @@ void FXJS_SetPrivate(v8::Isolate* pIsolate,
void* FXJS_GetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
- return NULL;
- CFXJS_PrivateData* pPrivateData = NULL;
- if (pObj->InternalFieldCount())
+ return nullptr;
+ CFXJS_PrivateData* pPrivateData = nullptr;
+ if (pObj->InternalFieldCount()) {
pPrivateData =
(CFXJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
- else {
+ } else {
// It could be a global proxy object.
v8::Local<v8::Value> v = pObj->GetPrototype();
- v8::Isolate* isolate = (v8::Isolate*)pIsolate;
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
+ v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
if (v->IsObject())
pPrivateData = (CFXJS_PrivateData*)v->ToObject(context)
.ToLocalChecked()
->GetAlignedPointerFromInternalField(0);
}
- if (!pPrivateData)
- return NULL;
- return pPrivateData->pPrivate;
+ return pPrivateData ? pPrivateData->pPrivate : nullptr;
}
void FXJS_FreePrivate(void* pPrivateData) {
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698