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

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp

Issue 1348393007: Merge to XFA: Remove CJS_RuntimeFactory (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 3 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 | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | 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 "../../../public/fpdf_formfill.h" 7 #include "../../../public/fpdf_formfill.h"
8 #include "../../include/fsdk_define.h" 8 #include "../../include/fsdk_define.h"
9 #include "../../include/fsdk_mgr.h" 9 #include "../../include/fsdk_mgr.h"
10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../../include/fpdfxfa/fpdfxfa_doc.h"
11 #include "../../include/fpdfxfa/fpdfxfa_util.h" 11 #include "../../include/fpdfxfa/fpdfxfa_util.h"
12 #include "../../include/jsapi/fxjs_v8.h" 12 #include "../../include/jsapi/fxjs_v8.h"
13 #include "../../include/javascript/IJavaScript.h" 13 #include "../../include/javascript/IJavaScript.h"
14 #include "../../include/fpdfxfa/fpdfxfa_app.h" 14 #include "../../include/fpdfxfa/fpdfxfa_app.h"
15 15
16 CPDFXFA_App* CPDFXFA_App::g_pApp = NULL; 16 CPDFXFA_App* CPDFXFA_App::g_pApp = NULL;
17 17
18 CPDFXFA_App* CPDFXFA_App::GetInstance() { 18 CPDFXFA_App* CPDFXFA_App::GetInstance() {
19 if (!g_pApp) { 19 if (!g_pApp) {
20 g_pApp = new CPDFXFA_App(); 20 g_pApp = new CPDFXFA_App();
21 } 21 }
22 return g_pApp; 22 return g_pApp;
23 } 23 }
24 24
25 void CPDFXFA_App::ReleaseInstance() { 25 void CPDFXFA_App::ReleaseInstance() {
26 delete g_pApp; 26 delete g_pApp;
27 g_pApp = NULL; 27 g_pApp = NULL;
28 } 28 }
29 29
30 CJS_RuntimeFactory* g_GetJSRuntimeFactory() {
31 static CJS_RuntimeFactory g_JSRuntimeFactory;
32 return &g_JSRuntimeFactory;
33 }
34
35 CPDFXFA_App::CPDFXFA_App() 30 CPDFXFA_App::CPDFXFA_App()
36 : m_bInitRuntime(FALSE), 31 : m_bInitRuntime(FALSE),
37 m_pXFAApp(NULL), 32 m_pXFAApp(NULL),
38 m_pFontMgr(NULL), 33 m_pFontMgr(NULL),
39 m_hJSERuntime(NULL), 34 m_hJSERuntime(NULL),
40 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { 35 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
41 m_pJSRuntimeFactory = g_GetJSRuntimeFactory();
42 m_pJSRuntimeFactory->AddRef();
43 m_pEnvList.RemoveAll(); 36 m_pEnvList.RemoveAll();
44 } 37 }
45 38
46 CPDFXFA_App::~CPDFXFA_App() { 39 CPDFXFA_App::~CPDFXFA_App() {
47 delete m_pFontMgr; 40 delete m_pFontMgr;
48 m_pFontMgr = NULL; 41 m_pFontMgr = NULL;
49 42
50 delete m_pXFAApp; 43 delete m_pXFAApp;
51 m_pXFAApp = NULL; 44 m_pXFAApp = NULL;
52 45
53 m_pJSRuntimeFactory->Release();
54 FXJSE_Runtime_Release(m_hJSERuntime); 46 FXJSE_Runtime_Release(m_hJSERuntime);
55 m_hJSERuntime = NULL; 47 m_hJSERuntime = NULL;
56 48
57 FXJSE_Finalize(); 49 FXJSE_Finalize();
58 BC_Library_Destory(); 50 BC_Library_Destory();
59 } 51 }
60 52
61 FX_BOOL CPDFXFA_App::Initialize() { 53 FX_BOOL CPDFXFA_App::Initialize() {
62 BC_Library_Init(); 54 BC_Library_Init();
63 FXJSE_Initialize(); 55 FXJSE_Initialize();
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return FALSE; 539 return FALSE;
548 } 540 }
549 541
550 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { 542 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() {
551 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; 543 CXFA_FWLAdapterTimerMgr* pAdapter = NULL;
552 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 544 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
553 if (pEnv) 545 if (pEnv)
554 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); 546 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv);
555 return pAdapter; 547 return pAdapter;
556 } 548 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/IJavaScript.h ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698