summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_isolatetracker.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-07-12 10:37:52 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-12 10:37:52 -0700
commit08fea801054f3afadb95d0a54efe7da6683c5c5d (patch)
treedc81937c50050c91e6f3ca483d2c0d9d1feceed0 /fxjs/cfxjse_isolatetracker.cpp
parent5a6c1398d0e559fb6a048cb0dca46ba9f9309a77 (diff)
downloadpdfium-08fea801054f3afadb95d0a54efe7da6683c5c5d.tar.xz
Rename fxjse/ to fxjs/ update files to match class names.
This Cl moves the fxjse/ directory to fxjs/ in anticipation of merging in fpdfsdk/jsapi. In the process the filenames are updated to better match the class contents. Static methods are moved to anonymous namespaces as possible. Review-Url: https://codereview.chromium.org/2136213002
Diffstat (limited to 'fxjs/cfxjse_isolatetracker.cpp')
-rw-r--r--fxjs/cfxjse_isolatetracker.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/fxjs/cfxjse_isolatetracker.cpp b/fxjs/cfxjse_isolatetracker.cpp
new file mode 100644
index 0000000000..9594df3109
--- /dev/null
+++ b/fxjs/cfxjse_isolatetracker.cpp
@@ -0,0 +1,35 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fxjs/cfxjse_isolatetracker.h"
+
+#include <algorithm>
+
+CFXJSE_IsolateTracker::CFXJSE_IsolateTracker() {}
+
+CFXJSE_IsolateTracker::~CFXJSE_IsolateTracker() {}
+
+void CFXJSE_IsolateTracker::Append(v8::Isolate* pIsolate) {
+ m_OwnedIsolates.push_back(pIsolate);
+}
+
+void CFXJSE_IsolateTracker::Remove(
+ v8::Isolate* pIsolate,
+ CFXJSE_IsolateTracker::DisposeCallback lpfnDisposeCallback) {
+ auto it = std::find(m_OwnedIsolates.begin(), m_OwnedIsolates.end(), pIsolate);
+ bool bFound = it != m_OwnedIsolates.end();
+ if (bFound)
+ m_OwnedIsolates.erase(it);
+ lpfnDisposeCallback(pIsolate, bFound);
+}
+
+void CFXJSE_IsolateTracker::RemoveAll(
+ CFXJSE_IsolateTracker::DisposeCallback lpfnDisposeCallback) {
+ for (v8::Isolate* pIsolate : m_OwnedIsolates)
+ lpfnDisposeCallback(pIsolate, true);
+
+ m_OwnedIsolates.clear();
+}