summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cfxjse_isolatetracker.cpp42
-rw-r--r--fxjs/cfxjse_isolatetracker.h20
-rw-r--r--fxjs/cfxjse_runtimedata.cpp38
-rw-r--r--fxjs/fxjse.h3
4 files changed, 0 insertions, 103 deletions
diff --git a/fxjs/cfxjse_isolatetracker.cpp b/fxjs/cfxjse_isolatetracker.cpp
deleted file mode 100644
index 0dd4158714..0000000000
--- a/fxjs/cfxjse_isolatetracker.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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>
-#include <utility>
-
-CFXJSE_IsolateTracker::CFXJSE_IsolateTracker() {}
-
-CFXJSE_IsolateTracker::~CFXJSE_IsolateTracker() {}
-
-void CFXJSE_IsolateTracker::Append(
- v8::Isolate* pIsolate,
- std::unique_ptr<v8::ArrayBuffer::Allocator> alloc) {
- m_OwnedIsolates.push_back(pIsolate);
- m_AllocatorMap[pIsolate] = std::move(alloc);
-}
-
-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);
-
- m_AllocatorMap.erase(pIsolate);
-}
-
-void CFXJSE_IsolateTracker::RemoveAll(
- CFXJSE_IsolateTracker::DisposeCallback lpfnDisposeCallback) {
- for (v8::Isolate* pIsolate : m_OwnedIsolates)
- lpfnDisposeCallback(pIsolate, true);
-
- m_OwnedIsolates.clear();
- m_AllocatorMap.clear();
-}
diff --git a/fxjs/cfxjse_isolatetracker.h b/fxjs/cfxjse_isolatetracker.h
index 5340d9b5c0..2bb16ca7ba 100644
--- a/fxjs/cfxjse_isolatetracker.h
+++ b/fxjs/cfxjse_isolatetracker.h
@@ -52,24 +52,4 @@ class CFXJSE_ScopeUtil_IsolateHandleRootContext {
v8::Context::Scope m_cscope;
};
-class CFXJSE_IsolateTracker {
- public:
- typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate);
-
- CFXJSE_IsolateTracker();
- ~CFXJSE_IsolateTracker();
-
- void Append(v8::Isolate* pIsolate,
- std::unique_ptr<v8::ArrayBuffer::Allocator> alloc);
- void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback);
- void RemoveAll(DisposeCallback lpfnDisposeCallback);
-
- static CFXJSE_IsolateTracker* g_pInstance;
-
- protected:
- std::vector<v8::Isolate*> m_OwnedIsolates;
- std::map<v8::Isolate*, std::unique_ptr<v8::ArrayBuffer::Allocator>>
- m_AllocatorMap;
-};
-
#endif // FXJS_CFXJSE_ISOLATETRACKER_H_
diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp
index be6938e762..b5c2de9297 100644
--- a/fxjs/cfxjse_runtimedata.cpp
+++ b/fxjs/cfxjse_runtimedata.cpp
@@ -11,42 +11,6 @@
#include "fxjs/cfxjse_isolatetracker.h"
#include "fxjs/fxjs_v8.h"
-namespace {
-
-void Runtime_DisposeCallback(v8::Isolate* pIsolate, bool bOwned) {
- if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate))
- delete pData;
- if (bOwned)
- pIsolate->Dispose();
-}
-
-void KillV8() {
- v8::V8::Dispose();
-}
-
-} // namespace
-
-void FXJSE_Initialize() {
- if (!CFXJSE_IsolateTracker::g_pInstance)
- CFXJSE_IsolateTracker::g_pInstance = new CFXJSE_IsolateTracker;
-
- static bool bV8Initialized = false;
- if (bV8Initialized)
- return;
-
- bV8Initialized = true;
- atexit(KillV8);
-}
-
-void FXJSE_Finalize() {
- if (!CFXJSE_IsolateTracker::g_pInstance)
- return;
-
- CFXJSE_IsolateTracker::g_pInstance->RemoveAll(Runtime_DisposeCallback);
- delete CFXJSE_IsolateTracker::g_pInstance;
- CFXJSE_IsolateTracker::g_pInstance = nullptr;
-}
-
CFXJSE_RuntimeData::CFXJSE_RuntimeData(v8::Isolate* pIsolate)
: m_pIsolate(pIsolate) {}
@@ -84,5 +48,3 @@ CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
pData->m_pFXJSERuntimeData = CFXJSE_RuntimeData::Create(pIsolate);
return pData->m_pFXJSERuntimeData.get();
}
-
-CFXJSE_IsolateTracker* CFXJSE_IsolateTracker::g_pInstance = nullptr;
diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h
index 9a38d20ddf..df1dff6243 100644
--- a/fxjs/fxjse.h
+++ b/fxjs/fxjse.h
@@ -61,9 +61,6 @@ struct FXJSE_CLASS_DESCRIPTOR {
FXJSE_FuncCallback dynMethodCall;
};
-void FXJSE_Initialize();
-void FXJSE_Finalize();
-
void FXJSE_ThrowMessage(const ByteStringView& utf8Message);
#endif // FXJS_FXJSE_H_