diff options
Diffstat (limited to 'fpdfsdk/src/jsapi/fxjs_v8.cpp')
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index 0822531da6..0c58a1b01f 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -30,24 +30,24 @@ static v8::Global<v8::ObjectTemplate>* g_DefaultGlobalObjectTemplate = nullptr; class CFXJS_PerObjectData { public: - CFXJS_PerObjectData(int nObjDefID) + explicit CFXJS_PerObjectData(int nObjDefID) : m_ObjDefID(nObjDefID), m_pPrivate(nullptr) {} - int m_ObjDefID; + const int m_ObjDefID; void* m_pPrivate; }; class CFXJS_ObjDefinition { public: static int MaxID(v8::Isolate* pIsolate) { - return static_cast<int>( - FXJS_PerIsolateData::Get(pIsolate)->m_ObjectDefnArray.GetSize()); + return FXJS_PerIsolateData::Get(pIsolate)->m_ObjectDefnArray.size(); } + static CFXJS_ObjDefinition* ForID(v8::Isolate* pIsolate, int id) { // Note: GetAt() halts if out-of-range even in release builds. - return static_cast<CFXJS_ObjDefinition*>( - FXJS_PerIsolateData::Get(pIsolate)->m_ObjectDefnArray.GetAt(id)); + return FXJS_PerIsolateData::Get(pIsolate)->m_ObjectDefnArray[id]; } + CFXJS_ObjDefinition(v8::Isolate* isolate, const wchar_t* sObjName, FXJSOBJTYPE eObjType, @@ -71,8 +71,8 @@ class CFXJS_ObjDefinition { int AssignID() { FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(m_pIsolate); - pData->m_ObjectDefnArray.Add(this); - return pData->m_ObjectDefnArray.GetSize() - 1; + pData->m_ObjectDefnArray.push_back(this); + return pData->m_ObjectDefnArray.size() - 1; } v8::Local<v8::ObjectTemplate> GetInstanceTemplate() { @@ -553,8 +553,7 @@ v8::Local<v8::Array> FXJS_GetObjectElementNames(v8::Isolate* pIsolate, void FXJS_PutObjectString(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj, const wchar_t* PropertyName, - const wchar_t* sValue) // VT_string -{ + const wchar_t* sValue) { if (pObj.IsEmpty()) return; pObj->Set(pIsolate->GetCurrentContext(), |