| Index: xfa/src/fwl/src/core/fwl_threadimp.cpp
|
| diff --git a/xfa/src/fwl/src/core/fwl_threadimp.cpp b/xfa/src/fwl/src/core/fwl_threadimp.cpp
|
| index 546f14ad74d76ffaea49113bd6c9b95f35c04f2f..6d399527b6110c4fb93869e16fa5903e10311dd5 100644
|
| --- a/xfa/src/fwl/src/core/fwl_threadimp.cpp
|
| +++ b/xfa/src/fwl/src/core/fwl_threadimp.cpp
|
| @@ -9,119 +9,30 @@
|
| #include "include/fwl_noteimp.h"
|
| #include "include/fwl_threadimp.h"
|
| #include "include/fwl_appimp.h"
|
| -IFWL_Thread* IFWL_Thread::Create() {
|
| - return (IFWL_Thread*)new CFWL_Thread;
|
| +
|
| +void IFWL_Thread::Release() {
|
| + delete m_pImpl;
|
| }
|
| -CFWL_Thread::CFWL_Thread() {}
|
| -CFWL_Thread::~CFWL_Thread() {}
|
| -FWL_ERR CFWL_Thread::Run(FWL_HTHREAD hThread) {
|
| - return FWL_ERR_Succeeded;
|
| +FWL_ERR IFWL_Thread::Run(FWL_HTHREAD hThread) {
|
| + return m_pImpl->Run(hThread);
|
| }
|
| -IFWL_NoteThread* IFWL_NoteThread::Create() {
|
| - return (IFWL_NoteThread*)new CFWL_NoteThread;
|
| +IFWL_NoteDriver* IFWL_NoteThread::GetNoteDriver() {
|
| + return static_cast<CFWL_NoteThreadImp*>(GetImpl())->GetNoteDriver();
|
| }
|
| -CFWL_NoteThread::CFWL_NoteThread() : m_hThread(NULL) {
|
| - m_pNoteDriver = new CFWL_NoteDriver;
|
| +
|
| +FWL_ERR CFWL_ThreadImp::Run(FWL_HTHREAD hThread) {
|
| + return FWL_ERR_Succeeded;
|
| }
|
| -CFWL_NoteThread::~CFWL_NoteThread() {
|
| - if (m_hThread) {
|
| - FWL_StopThread(m_hThread, 0);
|
| - }
|
| - if (m_pNoteDriver) {
|
| - delete m_pNoteDriver;
|
| - m_pNoteDriver = NULL;
|
| - }
|
| +CFWL_NoteThreadImp::CFWL_NoteThreadImp(IFWL_NoteThread* pIface)
|
| + : CFWL_ThreadImp(pIface), m_pNoteDriver(new CFWL_NoteDriver) {}
|
| +CFWL_NoteThreadImp::~CFWL_NoteThreadImp() {
|
| + delete m_pNoteDriver;
|
| }
|
| -FWL_ERR CFWL_NoteThread::Run(FWL_HTHREAD hThread) {
|
| +FWL_ERR CFWL_NoteThreadImp::Run(FWL_HTHREAD hThread) {
|
| if (!m_pNoteDriver)
|
| return FWL_ERR_Indefinite;
|
| - FWL_ERR result = m_pNoteDriver->Run();
|
| - return result;
|
| -}
|
| -IFWL_NoteDriver* CFWL_NoteThread::GetNoteDriver() {
|
| - return (IFWL_NoteDriver*)m_pNoteDriver;
|
| -}
|
| -extern IFWL_AdapterNative* FWL_GetAdapterNative();
|
| -FWL_HTHREAD FWL_StartThread(IFWL_Thread* pThread, FX_BOOL bSuspended) {
|
| - IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
|
| - if (!pNative)
|
| - return NULL;
|
| - IFWL_AdapterThreadMgr* pThreadMgr = pNative->GetThreadMgr();
|
| - if (!pThreadMgr)
|
| - return NULL;
|
| - FWL_HTHREAD hThread = NULL;
|
| - pThreadMgr->Start(pThread, hThread, bSuspended);
|
| - return hThread;
|
| -}
|
| -FWL_ERR FWL_ResumeThread(FWL_HTHREAD hThread) {
|
| - IFWL_AdapterNative* Native = FWL_GetAdapterNative();
|
| - if (!Native)
|
| - return FWL_ERR_Indefinite;
|
| - IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
|
| - if (!ThreadMgr)
|
| - return FWL_ERR_Indefinite;
|
| - return ThreadMgr->Resume(hThread);
|
| -}
|
| -FWL_ERR FWL_SuspendThread(FWL_HTHREAD hThread) {
|
| - IFWL_AdapterNative* Native = FWL_GetAdapterNative();
|
| - if (!Native)
|
| - return FWL_ERR_Indefinite;
|
| - IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
|
| - if (!ThreadMgr)
|
| - return FWL_ERR_Indefinite;
|
| - return ThreadMgr->Suspend(hThread);
|
| -}
|
| -FWL_ERR FWL_KillThread(FWL_HTHREAD hThread, int32_t iExitCode) {
|
| - IFWL_AdapterNative* Native = FWL_GetAdapterNative();
|
| - if (!Native)
|
| - return FWL_ERR_Indefinite;
|
| - IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
|
| - if (!ThreadMgr)
|
| - return FWL_ERR_Indefinite;
|
| - return ThreadMgr->Kill(hThread, iExitCode);
|
| -}
|
| -FWL_ERR FWL_StopThread(FWL_HTHREAD hThread, int32_t iExitCode) {
|
| - IFWL_AdapterNative* Native = FWL_GetAdapterNative();
|
| - if (!Native)
|
| - return FWL_ERR_Indefinite;
|
| - IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
|
| - if (!ThreadMgr)
|
| - return FWL_ERR_Indefinite;
|
| - return ThreadMgr->Stop(hThread, iExitCode);
|
| -}
|
| -FWL_HMUTEX FWL_CreateMutex() {
|
| - return NULL;
|
| -}
|
| -FWL_ERR FWL_DestroyMutex(FWL_HMUTEX hMutex) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_ERR FWL_LockMutex(FWL_HMUTEX hMutex) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_ERR FWL_TryLockMutex(FWL_HMUTEX hMutex) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_ERR FWL_UnlockMutex(FWL_HMUTEX hMutex) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_ERR FWL_IsLockedMutex(FWL_HMUTEX hMutex, FX_BOOL& bLocked) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_HSEMAPHORE FWL_CreateSemaphore() {
|
| - return (FWL_HSEMAPHORE)IFWL_AdapterSemaphore::Create();
|
| -}
|
| -FWL_ERR FWL_DestroySemaphore(FWL_HSEMAPHORE hSemaphore) {
|
| - return ((IFWL_AdapterSemaphore*)hSemaphore)->Destroy();
|
| -}
|
| -FWL_ERR FWL_WaitSemaphore(FWL_HSEMAPHORE hSemaphore) {
|
| - return ((IFWL_AdapterSemaphore*)hSemaphore)->Wait();
|
| -}
|
| -FWL_ERR FWL_PostSemaphore(FWL_HSEMAPHORE hSemaphore, int32_t down) {
|
| - return ((IFWL_AdapterSemaphore*)hSemaphore)->Post();
|
| -}
|
| -FWL_ERR FWL_GetSemaphoreValue(FWL_HSEMAPHORE hSemaphore, int32_t& value) {
|
| - return ((IFWL_AdapterSemaphore*)hSemaphore)->Value((FX_DWORD&)value);
|
| + return m_pNoteDriver->Run();
|
| }
|
| -FWL_ERR FWL_ResetSemaphore(FWL_HSEMAPHORE hSemaphore, int32_t init) {
|
| - return ((IFWL_AdapterSemaphore*)hSemaphore)->Reset(init);
|
| +IFWL_NoteDriver* CFWL_NoteThreadImp::GetNoteDriver() {
|
| + return m_pNoteDriver;
|
| }
|
|
|