diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-10 09:38:57 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-10 09:38:57 -0800 |
commit | d88a364c1c79b294b980c20ebc9356ea42635bff (patch) | |
tree | bb44b0a75a3671ba3e305e3d812dcc098144e851 /fpdfsdk/src/jsapi | |
parent | b553bcb6a8e69de61f3b4abd257ee3161aa752c6 (diff) | |
download | pdfium-d88a364c1c79b294b980c20ebc9356ea42635bff.tar.xz |
Merge to XFA: Remove CFX_PtrArray usage in fpdfsdk.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1430213002 .
(cherry picked from commit 8deeacd23872ecc132a0a678e344a018b5114a3a)
Review URL: https://codereview.chromium.org/1416113010 .
Diffstat (limited to 'fpdfsdk/src/jsapi')
-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 9be02ccb1e..2ff515d0ab 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() { @@ -558,8 +558,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(), |