summaryrefslogtreecommitdiff
path: root/xfa/fxjse/runtime.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-17 16:24:34 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-17 16:24:34 -0700
commit56286b311543331d02fee90b832d66389a307961 (patch)
tree250cc5a2eed0a796115316511a9917e2af3814e5 /xfa/fxjse/runtime.cpp
parent0c268e941972fd808d06033b68e22ec2c6648188 (diff)
downloadpdfium-56286b311543331d02fee90b832d66389a307961.tar.xz
Remove some CFX_ArrayTemplate<> usage from fxjse
Allows use of otherwise incompatible unique_ptrs. Review-Url: https://codereview.chromium.org/1992513002
Diffstat (limited to 'xfa/fxjse/runtime.cpp')
-rw-r--r--xfa/fxjse/runtime.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/xfa/fxjse/runtime.cpp b/xfa/fxjse/runtime.cpp
index 7b62174899..1ee6c18599 100644
--- a/xfa/fxjse/runtime.cpp
+++ b/xfa/fxjse/runtime.cpp
@@ -6,6 +6,8 @@
#include "xfa/fxjse/runtime.h"
+#include <algorithm>
+
#include "fpdfsdk/jsapi/include/fxjs_v8.h"
#include "xfa/fxjse/scope_inline.h"
@@ -99,30 +101,27 @@ CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
return pData->m_pFXJSERuntimeData;
}
-CFXJSE_RuntimeList* CFXJSE_RuntimeData::g_RuntimeList = NULL;
+CFXJSE_RuntimeList* CFXJSE_RuntimeData::g_RuntimeList = nullptr;
+
void CFXJSE_RuntimeList::AppendRuntime(v8::Isolate* pIsolate) {
- m_RuntimeList.Add(pIsolate);
+ m_RuntimeList.push_back(pIsolate);
}
void CFXJSE_RuntimeList::RemoveRuntime(
v8::Isolate* pIsolate,
CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) {
- int32_t iIdx = m_RuntimeList.Find(pIsolate, 0);
- if (iIdx >= 0) {
- m_RuntimeList.RemoveAt(iIdx, 1);
- }
- if (lpfnDisposeCallback) {
+ auto it = std::find(m_RuntimeList.begin(), m_RuntimeList.end(), pIsolate);
+ if (it != m_RuntimeList.end())
+ m_RuntimeList.erase(it);
+ if (lpfnDisposeCallback)
lpfnDisposeCallback(pIsolate);
- }
}
void CFXJSE_RuntimeList::RemoveAllRuntimes(
CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) {
- int32_t iSize = m_RuntimeList.GetSize();
if (lpfnDisposeCallback) {
- for (int32_t iIdx = 0; iIdx < iSize; iIdx++) {
- lpfnDisposeCallback(m_RuntimeList[iIdx]);
- }
+ for (v8::Isolate* pIsolate : m_RuntimeList)
+ lpfnDisposeCallback(pIsolate);
}
- m_RuntimeList.RemoveAll();
+ m_RuntimeList.clear();
}