summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/jsapi/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-06 14:52:10 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-06 14:52:10 -0800
commit6cf117caa54c3bbf5a787c9ae9ca517a4ac98a16 (patch)
tree9fbfd7bfe436ee6fe0245814d410f702da92b648 /fpdfsdk/src/jsapi/fxjs_v8.cpp
parent8241df7edc53b8777e7f71ff379fa53f368c3a28 (diff)
downloadpdfium-6cf117caa54c3bbf5a787c9ae9ca517a4ac98a16.tar.xz
Merge to XFA: Rename CFXJS_PrivateData to CFXJS_PerObjectData.
Original Review URL: https://codereview.chromium.org/1424933012 . (cherry picked from commit b2dd2c96f6271a1520c36d707b626a34c72f7fb6) R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1411333006 .
Diffstat (limited to 'fpdfsdk/src/jsapi/fxjs_v8.cpp')
-rw-r--r--fpdfsdk/src/jsapi/fxjs_v8.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index 1801f661ab..5340ff4fd9 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -28,12 +28,13 @@ static size_t g_isolate_ref_count = 0;
static FXJS_ArrayBufferAllocator* g_arrayBufferAllocator = nullptr;
static v8::Global<v8::ObjectTemplate>* g_DefaultGlobalObjectTemplate = nullptr;
-class CFXJS_PrivateData {
+class CFXJS_PerObjectData {
public:
- CFXJS_PrivateData(int nObjDefID) : ObjDefID(nObjDefID), pPrivate(NULL) {}
+ CFXJS_PerObjectData(int nObjDefID)
+ : m_ObjDefID(nObjDefID), m_pPrivate(nullptr) {}
- int ObjDefID;
- void* pPrivate;
+ int m_ObjDefID;
+ void* m_pPrivate;
};
class CFXJS_ObjDefinition {
@@ -302,7 +303,7 @@ void FXJS_InitializeRuntime(v8::Isolate* pIsolate,
->GetPrototype()
->ToObject(v8Context)
.ToLocalChecked()
- ->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(i));
+ ->SetAlignedPointerInInternalField(0, new CFXJS_PerObjectData(i));
if (pObjDef->m_pConstructor)
pObjDef->m_pConstructor(pIRuntime, v8Context->Global()
@@ -420,7 +421,7 @@ v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate,
if (!pObjDef->GetInstanceTemplate()->NewInstance(context).ToLocal(&obj))
return v8::Local<v8::Object>();
- obj->SetAlignedPointerInInternalField(0, new CFXJS_PrivateData(nObjDefnID));
+ obj->SetAlignedPointerInInternalField(0, new CFXJS_PerObjectData(nObjDefnID));
if (pObjDef->m_pConstructor)
pObjDef->m_pConstructor(pIRuntime, obj);
@@ -440,10 +441,10 @@ v8::Local<v8::Object> FXJS_GetThisObj(v8::Isolate* pIsolate) {
int FXJS_GetObjDefnID(v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty() || !pObj->InternalFieldCount())
return -1;
- CFXJS_PrivateData* pPrivateData =
- (CFXJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
- if (pPrivateData)
- return pPrivateData->ObjDefID;
+ CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>(
+ pObj->GetAlignedPointerFromInternalField(0));
+ if (pPerObjectData)
+ return pPerObjectData->m_ObjDefID;
return -1;
}
@@ -482,35 +483,36 @@ void FXJS_SetPrivate(v8::Isolate* pIsolate,
void* p) {
if (pObj.IsEmpty() || !pObj->InternalFieldCount())
return;
- CFXJS_PrivateData* pPrivateData =
- (CFXJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
- if (!pPrivateData)
+ CFXJS_PerObjectData* pPerObjectData = static_cast<CFXJS_PerObjectData*>(
+ pObj->GetAlignedPointerFromInternalField(0));
+ if (!pPerObjectData)
return;
- pPrivateData->pPrivate = p;
+ pPerObjectData->m_pPrivate = p;
}
void* FXJS_GetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj) {
if (pObj.IsEmpty())
return nullptr;
- CFXJS_PrivateData* pPrivateData = nullptr;
+ CFXJS_PerObjectData* pPerObjectData = nullptr;
if (pObj->InternalFieldCount()) {
- pPrivateData =
- (CFXJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
+ pPerObjectData = static_cast<CFXJS_PerObjectData*>(
+ pObj->GetAlignedPointerFromInternalField(0));
} else {
// It could be a global proxy object.
v8::Local<v8::Value> v = pObj->GetPrototype();
v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
if (v->IsObject()) {
- pPrivateData = (CFXJS_PrivateData*)v->ToObject(context)
- .ToLocalChecked()
- ->GetAlignedPointerFromInternalField(0);
+ pPerObjectData = static_cast<CFXJS_PerObjectData*>(
+ v->ToObject(context)
+ .ToLocalChecked()
+ ->GetAlignedPointerFromInternalField(0));
}
}
- return pPrivateData ? pPrivateData->pPrivate : nullptr;
+ return pPerObjectData ? pPerObjectData->m_pPrivate : nullptr;
}
-void FXJS_FreePrivate(void* pPrivateData) {
- delete (CFXJS_PrivateData*)pPrivateData;
+void FXJS_FreePrivate(void* pPerObjectData) {
+ delete static_cast<CFXJS_PerObjectData*>(pPerObjectData);
}
void FXJS_FreePrivate(v8::Local<v8::Object> pObj) {