Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: xfa/src/fxjse/src/runtime.cpp

Issue 887073005: Merge https://codereview.chromium.org/897973002/ and https://codereview.chromium.org/902753002/ to … (Closed) Base URL: https://pdfium.googlesource.com/pdfium@xfa
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samples/samples.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « samples/samples.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698