| OLD | NEW | 
|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 
| 6 | 6 | 
| 7 #include "xfa/fxjse/runtime.h" | 7 #include "xfa/fxjse/runtime.h" | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 | 10 | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 29   } | 29   } | 
| 30   static FX_BOOL bV8Initialized = FALSE; | 30   static FX_BOOL bV8Initialized = FALSE; | 
| 31   if (bV8Initialized) { | 31   if (bV8Initialized) { | 
| 32     return; | 32     return; | 
| 33   } | 33   } | 
| 34   bV8Initialized = TRUE; | 34   bV8Initialized = TRUE; | 
| 35   atexit(FXJSE_KillV8); | 35   atexit(FXJSE_KillV8); | 
| 36 } | 36 } | 
| 37 | 37 | 
| 38 static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) { | 38 static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) { | 
| 39   { | 39   if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) { | 
| 40     v8::Locker locker(pIsolate); | 40     delete pData->m_pFXJSERuntimeData; | 
| 41     if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) { | 41     pData->m_pFXJSERuntimeData = nullptr; | 
| 42       delete pData->m_pFXJSERuntimeData; |  | 
| 43       pData->m_pFXJSERuntimeData = nullptr; |  | 
| 44     } |  | 
| 45   } | 42   } | 
| 46   pIsolate->Dispose(); | 43   pIsolate->Dispose(); | 
| 47 } | 44 } | 
| 48 | 45 | 
| 49 void FXJSE_Finalize() { | 46 void FXJSE_Finalize() { | 
| 50   if (CFXJSE_RuntimeData::g_RuntimeList) { | 47   if (CFXJSE_RuntimeData::g_RuntimeList) { | 
| 51     CFXJSE_RuntimeData::g_RuntimeList->RemoveAllRuntimes( | 48     CFXJSE_RuntimeData::g_RuntimeList->RemoveAllRuntimes( | 
| 52         FXJSE_Runtime_DisposeCallback); | 49         FXJSE_Runtime_DisposeCallback); | 
| 53     delete CFXJSE_RuntimeData::g_RuntimeList; | 50     delete CFXJSE_RuntimeData::g_RuntimeList; | 
| 54     CFXJSE_RuntimeData::g_RuntimeList = NULL; | 51     CFXJSE_RuntimeData::g_RuntimeList = NULL; | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 117 } | 114 } | 
| 118 | 115 | 
| 119 void CFXJSE_RuntimeList::RemoveAllRuntimes( | 116 void CFXJSE_RuntimeList::RemoveAllRuntimes( | 
| 120     CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { | 117     CFXJSE_RuntimeList::RuntimeDisposeCallback lpfnDisposeCallback) { | 
| 121   if (lpfnDisposeCallback) { | 118   if (lpfnDisposeCallback) { | 
| 122     for (v8::Isolate* pIsolate : m_RuntimeList) | 119     for (v8::Isolate* pIsolate : m_RuntimeList) | 
| 123       lpfnDisposeCallback(pIsolate); | 120       lpfnDisposeCallback(pIsolate); | 
| 124   } | 121   } | 
| 125   m_RuntimeList.clear(); | 122   m_RuntimeList.clear(); | 
| 126 } | 123 } | 
| OLD | NEW | 
|---|