Добавлен CMonoDomain::ReleaseClass для удаления класса из пула. Добавлена ссылка на MonoInterface

This commit is contained in:
Kernell 2015-11-30 06:21:30 +03:00
parent de37d2bda1
commit 1dc1390070
3 changed files with 17 additions and 4 deletions

View File

@ -12,8 +12,9 @@
#include "CMonoDomain.h" #include "CMonoDomain.h"
CMonoDomain::CMonoDomain( CResource* pResource, MonoDomain* pDomain ) CMonoDomain::CMonoDomain( CMonoInterface* pMono, MonoDomain* pDomain, CResource* pResource )
{ {
this->m_pMono = pMono;
this->m_pDomain = pDomain; this->m_pDomain = pDomain;
this->m_pResource = pResource; this->m_pResource = pResource;
@ -63,6 +64,14 @@ CMonoClass* CMonoDomain::FindOrAdd( MonoClass* klass )
return nullptr; return nullptr;
} }
void CMonoDomain::ReleaseClass( CMonoClass* pClass )
{
if( !this->m_ClassPool.empty() )
{
this->m_ClassPool.remove( pClass );
}
}
void CMonoDomain::Init( void ) void CMonoDomain::Init( void )
{ {
this->m_pCorlib = new CMonoCorlib( this ); this->m_pCorlib = new CMonoCorlib( this );

View File

@ -15,6 +15,7 @@ class CMonoDomain;
#ifndef __CMONODOMAIN_H #ifndef __CMONODOMAIN_H
#define __CMONODOMAIN_H #define __CMONODOMAIN_H
#include "CMonoInterface.h"
#include "CMonoCorlib.h" #include "CMonoCorlib.h"
#include "CMonoMTALib.h" #include "CMonoMTALib.h"
#include "CMonoClass.h" #include "CMonoClass.h"
@ -27,17 +28,19 @@ class CMonoDomain
private: private:
MonoDomain* m_pDomain; MonoDomain* m_pDomain;
CResource* m_pResource; CResource* m_pResource;
CMonoInterface* m_pMono;
CMonoCorlib* m_pCorlib; CMonoCorlib* m_pCorlib;
CMonoMTALib* m_pMTALib; CMonoMTALib* m_pMTALib;
vector< CMonoClass* > m_ClassPool; list< CMonoClass* > m_ClassPool;
public: public:
CMonoDomain ( CResource* pResource, MonoDomain* pDomain ); CMonoDomain ( CMonoInterface* pMono, MonoDomain* pDomain, CResource* pResource );
~CMonoDomain ( void ); ~CMonoDomain ( void );
CMonoClass* FindOrAdd ( MonoClass* klass ); CMonoClass* FindOrAdd ( MonoClass* klass );
void ReleaseClass ( CMonoClass* pClass );
void Init ( void ); void Init ( void );
@ -88,6 +91,7 @@ public:
MonoDomain* GetMonoPtr ( void ) { return this->m_pDomain; } MonoDomain* GetMonoPtr ( void ) { return this->m_pDomain; }
CMonoInterface* GetMono ( void ) { return this->m_pMono; }
CResource* GetResource ( void ) { return this->m_pResource; } CResource* GetResource ( void ) { return this->m_pResource; }
CMonoCorlib* GetCorlib ( void ) { return this->m_pCorlib; } CMonoCorlib* GetCorlib ( void ) { return this->m_pCorlib; }

View File

@ -43,7 +43,7 @@ CMonoDomain* CMonoInterface::CreateAppdomain( CResource* pResource, char* szName
if( pMonoDomain ) if( pMonoDomain )
{ {
return new CMonoDomain( pResource, pMonoDomain ); return new CMonoDomain( this, pMonoDomain, pResource );
} }
return nullptr; return nullptr;