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

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

Issue 2173253002: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.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 "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h"
8 8
9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h"
10 #include "fpdfsdk/include/fsdk_define.h" 10 #include "fpdfsdk/include/fsdk_define.h"
(...skipping 15 matching lines...) Expand all
26 return g_pApp; 26 return g_pApp;
27 } 27 }
28 28
29 void CPDFXFA_App::ReleaseInstance() { 29 void CPDFXFA_App::ReleaseInstance() {
30 delete g_pApp; 30 delete g_pApp;
31 g_pApp = nullptr; 31 g_pApp = nullptr;
32 } 32 }
33 33
34 CPDFXFA_App::CPDFXFA_App() 34 CPDFXFA_App::CPDFXFA_App()
35 : m_bJavaScriptInitialized(FALSE), 35 : m_bJavaScriptInitialized(FALSE),
36 m_pXFAApp(nullptr),
37 m_pIsolate(nullptr), 36 m_pIsolate(nullptr),
38 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { 37 m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
39 m_pEnvList.RemoveAll(); 38 m_pEnvList.RemoveAll();
40 } 39 }
41 40
42 CPDFXFA_App::~CPDFXFA_App() { 41 CPDFXFA_App::~CPDFXFA_App() {
43 delete m_pXFAApp;
44 m_pXFAApp = nullptr;
45
46 FXJSE_Runtime_Release(m_pIsolate); 42 FXJSE_Runtime_Release(m_pIsolate);
47 m_pIsolate = nullptr; 43 m_pIsolate = nullptr;
48 44
49 FXJSE_Finalize(); 45 FXJSE_Finalize();
50 BC_Library_Destory(); 46 BC_Library_Destory();
51 } 47 }
52 48
53 FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) { 49 FX_BOOL CPDFXFA_App::Initialize(v8::Isolate* pIsolate) {
54 BC_Library_Init(); 50 BC_Library_Init();
55 FXJSE_Initialize(); 51 FXJSE_Initialize();
56 52
57 m_pIsolate = pIsolate ? pIsolate : FXJSE_Runtime_Create_Own(); 53 m_pIsolate = pIsolate ? pIsolate : FXJSE_Runtime_Create_Own();
58 if (!m_pIsolate) 54 if (!m_pIsolate)
59 return FALSE; 55 return FALSE;
60 56
61 m_pXFAApp = new CXFA_FFApp(this); 57 m_pXFAApp.reset(new CXFA_FFApp(this));
62 m_pXFAApp->SetDefaultFontMgr( 58 m_pXFAApp->SetDefaultFontMgr(
63 std::unique_ptr<CXFA_DefFontMgr>(new CXFA_DefFontMgr)); 59 std::unique_ptr<CXFA_DefFontMgr>(new CXFA_DefFontMgr));
64 60
65 return TRUE; 61 return TRUE;
66 } 62 }
67 63
68 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) { 64 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) {
69 if (!pEnv) 65 if (!pEnv)
70 return FALSE; 66 return FALSE;
71 67
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 348 }
353 } 349 }
354 350
355 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { 351 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() {
356 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr; 352 CXFA_FWLAdapterTimerMgr* pAdapter = nullptr;
357 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 353 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
358 if (pEnv) 354 if (pEnv)
359 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); 355 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv);
360 return pAdapter; 356 return pAdapter;
361 } 357 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698