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

Side by Side Diff: fpdfsdk/src/fsdk_mgr.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/src/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.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_ext.h" 7 #include "../../public/fpdf_ext.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" 9 #include "../include/fpdfxfa/fpdfxfa_doc.h"
10 #include "../include/fpdfxfa/fpdfxfa_page.h" 10 #include "../include/fpdfxfa/fpdfxfa_page.h"
11 #include "../include/fpdfxfa/fpdfxfa_util.h" 11 #include "../include/fpdfxfa/fpdfxfa_util.h"
12 #include "../include/fsdk_mgr.h" 12 #include "../include/fsdk_mgr.h"
13 #include "../include/formfiller/FFL_FormFiller.h" 13 #include "../include/formfiller/FFL_FormFiller.h"
14 #include "../include/javascript/IJavaScript.h" 14 #include "../include/javascript/IJavaScript.h"
15 #include "../include/fpdfxfa/fpdfxfa_app.h" 15 #include "../include/fpdfxfa/fpdfxfa_app.h"
16 #include "../include/javascript/JS_Runtime.h"
16 17
17 #if _FX_OS_ == _FX_ANDROID_ 18 #if _FX_OS_ == _FX_ANDROID_
18 #include "time.h" 19 #include "time.h"
19 #else 20 #else
20 #include <ctime> 21 #include <ctime>
21 #endif 22 #endif
22 23
23 class CFX_SystemHandler : public IFX_SystemHandler { 24 class CFX_SystemHandler : public IFX_SystemHandler {
24 public: 25 public:
25 CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {} 26 CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {}
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() { 205 FX_SYSTEMTIME CFX_SystemHandler::GetLocalTime() {
205 return m_pEnv->FFI_GetLocalTime(); 206 return m_pEnv->FFI_GetLocalTime();
206 } 207 }
207 208
208 CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc, 209 CPDFDoc_Environment::CPDFDoc_Environment(CPDFXFA_Document* pDoc,
209 FPDF_FORMFILLINFO* pFFinfo) 210 FPDF_FORMFILLINFO* pFFinfo)
210 : m_pAnnotHandlerMgr(NULL), 211 : m_pAnnotHandlerMgr(NULL),
211 m_pActionHandler(NULL), 212 m_pActionHandler(NULL),
212 m_pJSRuntime(NULL),
213 m_pInfo(pFFinfo), 213 m_pInfo(pFFinfo),
214 m_pSDKDoc(NULL), 214 m_pSDKDoc(NULL),
215 m_pXFADoc(pDoc), 215 m_pXFADoc(pDoc),
216 m_pIFormFiller(NULL) { 216 m_pIFormFiller(NULL) {
217 m_pSysHandler = new CFX_SystemHandler(this); 217 m_pSysHandler = new CFX_SystemHandler(this);
218 } 218 }
219 219
220 CPDFDoc_Environment::~CPDFDoc_Environment() { 220 CPDFDoc_Environment::~CPDFDoc_Environment() {
221 delete m_pIFormFiller; 221 delete m_pIFormFiller;
222 m_pIFormFiller = NULL; 222 m_pIFormFiller = NULL;
223 223
224 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); 224 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
225 if (m_pJSRuntime && pProvider->GetRuntimeFactory())
226 pProvider->GetRuntimeFactory()->DeleteJSRuntime(m_pJSRuntime);
227
228 if (pProvider->m_pEnvList.GetSize() == 0) { 225 if (pProvider->m_pEnvList.GetSize() == 0) {
229 pProvider->ReleaseRuntime(); 226 pProvider->ReleaseRuntime();
230 pProvider->InitRuntime(TRUE); 227 pProvider->InitRuntime(TRUE);
231 } 228 }
232 229
233 delete m_pSysHandler; 230 delete m_pSysHandler;
234 m_pSysHandler = NULL; 231 m_pSysHandler = NULL;
235 232
236 delete m_pAnnotHandlerMgr; 233 delete m_pAnnotHandlerMgr;
237 m_pAnnotHandlerMgr = NULL; 234 m_pAnnotHandlerMgr = NULL;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 bsBcc.ReleaseBuffer(); 376 bsBcc.ReleaseBuffer();
380 bsSubject.ReleaseBuffer(); 377 bsSubject.ReleaseBuffer();
381 bsMsg.ReleaseBuffer(); 378 bsMsg.ReleaseBuffer();
382 } 379 }
383 } 380 }
384 381
385 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() { 382 IFXJS_Runtime* CPDFDoc_Environment::GetJSRuntime() {
386 if (!IsJSInitiated()) 383 if (!IsJSInitiated())
387 return NULL; 384 return NULL;
388 if (!m_pJSRuntime) 385 if (!m_pJSRuntime)
389 m_pJSRuntime = 386 m_pJSRuntime.reset(new CJS_Runtime(this));
390 CPDFXFA_App::GetInstance()->GetRuntimeFactory()->NewJSRuntime(this); 387 return m_pJSRuntime.get();
391 return m_pJSRuntime;
392 } 388 }
393 389
394 CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() { 390 CPDFSDK_AnnotHandlerMgr* CPDFDoc_Environment::GetAnnotHandlerMgr() {
395 if (!m_pAnnotHandlerMgr) 391 if (!m_pAnnotHandlerMgr)
396 m_pAnnotHandlerMgr = new CPDFSDK_AnnotHandlerMgr(this); 392 m_pAnnotHandlerMgr = new CPDFSDK_AnnotHandlerMgr(this);
397 return m_pAnnotHandlerMgr; 393 return m_pAnnotHandlerMgr;
398 } 394 }
399 395
400 CPDFSDK_ActionHandler* CPDFDoc_Environment::GetActionHander() { 396 CPDFSDK_ActionHandler* CPDFDoc_Environment::GetActionHander() {
401 if (!m_pActionHandler) 397 if (!m_pActionHandler)
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 if (!pFocusAnnot) 1191 if (!pFocusAnnot)
1196 return NULL; 1192 return NULL;
1197 1193
1198 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { 1194 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) {
1199 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); 1195 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);
1200 if (pAnnot == pFocusAnnot) 1196 if (pAnnot == pFocusAnnot)
1201 return pAnnot; 1197 return pAnnot;
1202 } 1198 }
1203 return NULL; 1199 return NULL;
1204 } 1200 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/src/javascript/JS_Runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698