summaryrefslogtreecommitdiff
path: root/fxjse
diff options
context:
space:
mode:
Diffstat (limited to 'fxjse')
-rw-r--r--fxjse/class.cpp5
-rw-r--r--fxjse/include/cfxjse_class.h5
-rw-r--r--fxjse/include/cfxjse_value.h3
-rw-r--r--fxjse/runtime.cpp9
-rw-r--r--fxjse/runtime.h18
-rw-r--r--fxjse/value.cpp4
6 files changed, 36 insertions, 8 deletions
diff --git a/fxjse/class.cpp b/fxjse/class.cpp
index bb133fba58..1dba7f073f 100644
--- a/fxjse/class.cpp
+++ b/fxjse/class.cpp
@@ -272,6 +272,11 @@ CFXJSE_Class* CFXJSE_Class::Create(
return pClass;
}
+CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext)
+ : m_lpClassDefinition(nullptr), m_pContext(lpContext) {}
+
+CFXJSE_Class::~CFXJSE_Class() {}
+
CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext,
const CFX_ByteStringC& szName) {
for (const auto& pClass : pContext->m_rgClasses) {
diff --git a/fxjse/include/cfxjse_class.h b/fxjse/include/cfxjse_class.h
index bb1db6d48c..b4953d21d3 100644
--- a/fxjse/include/cfxjse_class.h
+++ b/fxjse/include/cfxjse_class.h
@@ -16,6 +16,8 @@ class CFXJSE_Value;
class CFXJSE_Class {
public:
+ ~CFXJSE_Class();
+
static CFXJSE_Class* Create(CFXJSE_Context* pContext,
const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion,
FX_BOOL bIsJSGlobal = FALSE);
@@ -30,8 +32,7 @@ class CFXJSE_Class {
v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; }
protected:
- explicit CFXJSE_Class(CFXJSE_Context* lpContext)
- : m_lpClassDefinition(nullptr), m_pContext(lpContext) {}
+ explicit CFXJSE_Class(CFXJSE_Context* lpContext);
CFX_ByteString m_szClassName;
const FXJSE_CLASS_DESCRIPTOR* m_lpClassDefinition;
diff --git a/fxjse/include/cfxjse_value.h b/fxjse/include/cfxjse_value.h
index 74b4bab2e2..6e14d48f8f 100644
--- a/fxjse/include/cfxjse_value.h
+++ b/fxjse/include/cfxjse_value.h
@@ -11,7 +11,8 @@
class CFXJSE_Value {
public:
- CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {}
+ explicit CFXJSE_Value(v8::Isolate* pIsolate);
+ ~CFXJSE_Value();
FX_BOOL IsUndefined() const {
if (m_hValue.IsEmpty()) {
diff --git a/fxjse/runtime.cpp b/fxjse/runtime.cpp
index bf171eef7e..29814bdc7e 100644
--- a/fxjse/runtime.cpp
+++ b/fxjse/runtime.cpp
@@ -69,6 +69,11 @@ void FXJSE_Runtime_Release(v8::Isolate* pIsolate) {
FXJSE_Runtime_DisposeCallback);
}
+CFXJSE_RuntimeData::CFXJSE_RuntimeData(v8::Isolate* pIsolate)
+ : m_pIsolate(pIsolate) {}
+
+CFXJSE_RuntimeData::~CFXJSE_RuntimeData() {}
+
CFXJSE_RuntimeData* CFXJSE_RuntimeData::Create(v8::Isolate* pIsolate) {
CFXJSE_RuntimeData* pRuntimeData = new CFXJSE_RuntimeData(pIsolate);
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
@@ -92,6 +97,10 @@ CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
CFXJSE_IsolateTracker* CFXJSE_IsolateTracker::g_pInstance = nullptr;
+CFXJSE_IsolateTracker::CFXJSE_IsolateTracker() {}
+
+CFXJSE_IsolateTracker::~CFXJSE_IsolateTracker() {}
+
void CFXJSE_IsolateTracker::Append(v8::Isolate* pIsolate) {
m_OwnedIsolates.push_back(pIsolate);
}
diff --git a/fxjse/runtime.h b/fxjse/runtime.h
index e3b4113a50..ff3be3a521 100644
--- a/fxjse/runtime.h
+++ b/fxjse/runtime.h
@@ -16,6 +16,8 @@ class CFXJSE_RuntimeList;
class CFXJSE_RuntimeData {
public:
+ ~CFXJSE_RuntimeData();
+
static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);
v8::Isolate* m_pIsolate;
@@ -23,22 +25,28 @@ class CFXJSE_RuntimeData {
v8::Global<v8::Context> m_hRootContext;
protected:
+ explicit CFXJSE_RuntimeData(v8::Isolate* pIsolate);
+
static CFXJSE_RuntimeData* Create(v8::Isolate* pIsolate);
- CFXJSE_RuntimeData(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {}
- CFXJSE_RuntimeData();
- CFXJSE_RuntimeData(const CFXJSE_RuntimeData&);
- CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&);
+
+ private:
+ CFXJSE_RuntimeData(const CFXJSE_RuntimeData&) = delete;
+ CFXJSE_RuntimeData& operator=(const CFXJSE_RuntimeData&) = delete;
};
class CFXJSE_IsolateTracker {
public:
typedef void (*DisposeCallback)(v8::Isolate*, bool bOwnedIsolate);
- static CFXJSE_IsolateTracker* g_pInstance;
+
+ CFXJSE_IsolateTracker();
+ ~CFXJSE_IsolateTracker();
void Append(v8::Isolate* pIsolate);
void Remove(v8::Isolate* pIsolate, DisposeCallback lpfnDisposeCallback);
void RemoveAll(DisposeCallback lpfnDisposeCallback);
+ static CFXJSE_IsolateTracker* g_pInstance;
+
protected:
std::vector<v8::Isolate*> m_OwnedIsolates;
};
diff --git a/fxjse/value.cpp b/fxjse/value.cpp
index 743169dd7b..aba640210a 100644
--- a/fxjse/value.cpp
+++ b/fxjse/value.cpp
@@ -64,6 +64,10 @@ void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) {
pIsolate->ThrowException(hError);
}
+CFXJSE_Value::CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {}
+
+CFXJSE_Value::~CFXJSE_Value() {}
+
CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const {
ASSERT(!m_hValue.IsEmpty());