Chromium Code Reviews| 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 "../../foxitlib.h" | 7 #include "../../foxitlib.h" |
| 8 #include "fxv8.h" | 8 #include "fxv8.h" |
| 9 #include "runtime.h" | 9 #include "runtime.h" |
| 10 #include "scope_inline.h" | 10 #include "scope_inline.h" |
| 11 static void FXJSE_KillV8() | 11 static void FXJSE_KillV8() |
| 12 { | 12 { |
| 13 v8::V8::Dispose(); | 13 v8::V8::Dispose(); |
| 14 } | 14 } |
| 15 void FXJSE_Initialize() | 15 void FXJSE_Initialize() |
| 16 { | 16 { |
| 17 if(!CFXJSE_RuntimeData::g_RuntimeList) { | 17 if(!CFXJSE_RuntimeData::g_RuntimeList) { |
| 18 CFXJSE_RuntimeData::g_RuntimeList = FX_NEW CFXJSE_RuntimeList; | 18 CFXJSE_RuntimeData::g_RuntimeList = FX_NEW CFXJSE_RuntimeList; |
| 19 } | 19 } |
| 20 static FX_BOOL bV8Initialized = FALSE; | 20 static FX_BOOL bV8Initialized = FALSE; |
| 21 if (bV8Initialized) { | 21 if (bV8Initialized) { |
| 22 return; | 22 return; |
| 23 } | 23 } |
| 24 bV8Initialized = TRUE; | 24 bV8Initialized = TRUE; |
| 25 atexit(FXJSE_KillV8); | 25 atexit(FXJSE_KillV8); |
| 26 FX_LPCSTR szCmdFlags = | 26 FX_LPCSTR szCmdFlags = |
| 27 "--harmony_proxies " | 27 "--harmony_proxies " |
| 28 "--block_concurrent_recompilation " | 28 "--block_concurrent_recompilation " |
| 29 ; | 29 ; |
| 30 v8::V8::SetFlagsFromString(szCmdFlags, FXSYS_strlen(szCmdFlags)); | 30 v8::V8::SetFlagsFromString(szCmdFlags, FXSYS_strlen(szCmdFlags)); |
|
jam
2015/02/05 01:41:19
I don't know if this works anymore
|
jochen (gone - plz use gerrit)
2015/02/06 10:27:12
this works in the sense that it sets the flag.
It
jun_fang
2015/02/09 23:44:32
Feedback from our developers, according to current
|
| 31 v8::V8::InitializeICU(); | |
| 32 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); | |
| 33 v8::V8::InitializePlatform(platform); | |
| 34 v8::V8::Initialize(); | |
| 35 } | 31 } |
| 36 static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) | 32 static void FXJSE_Runtime_DisposeCallback(v8::Isolate* pIsolate) |
| 37 { | 33 { |
| 38 { | 34 { |
| 39 v8::Locker locker(pIsolate); | 35 v8::Locker locker(pIsolate); |
| 40 CFXJSE_RuntimeData *pRuntimeData = reinterpret_cast<CFXJSE_RuntimeData*> (pIsolate->GetData(0)); | 36 CFXJSE_RuntimeData *pRuntimeData = reinterpret_cast<CFXJSE_RuntimeData*> (pIsolate->GetData(0)); |
| 41 if(pRuntimeData) { | 37 if(pRuntimeData) { |
| 42 pIsolate->SetData(0, NULL); | 38 pIsolate->SetData(0, NULL); |
| 43 delete pRuntimeData; | 39 delete pRuntimeData; |
| 44 } | 40 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 void CFXJSE_RuntimeList::RemoveAllRuntimes(CFXJSE_RuntimeList::RuntimeDisposeCal lback lpfnDisposeCallback) | 105 void CFXJSE_RuntimeList::RemoveAllRuntimes(CFXJSE_RuntimeList::RuntimeDisposeCal lback lpfnDisposeCallback) |
| 110 { | 106 { |
| 111 FX_INT32 iSize = m_RuntimeList.GetSize(); | 107 FX_INT32 iSize = m_RuntimeList.GetSize(); |
| 112 if(lpfnDisposeCallback) { | 108 if(lpfnDisposeCallback) { |
| 113 for(FX_INT32 iIdx = 0; iIdx < iSize; iIdx++) { | 109 for(FX_INT32 iIdx = 0; iIdx < iSize; iIdx++) { |
| 114 lpfnDisposeCallback(m_RuntimeList[iIdx]); | 110 lpfnDisposeCallback(m_RuntimeList[iIdx]); |
| 115 } | 111 } |
| 116 } | 112 } |
| 117 m_RuntimeList.RemoveAll(); | 113 m_RuntimeList.RemoveAll(); |
| 118 } | 114 } |
| OLD | NEW |