| 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 "fpdfsdk/javascript/global.h" | 7 #include "fpdfsdk/javascript/global.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); | 87 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); |
| 88 | 88 |
| 89 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { | 89 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { |
| 90 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); | 90 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); |
| 91 JSGlobalAlternate* pGlobal = | 91 JSGlobalAlternate* pGlobal = |
| 92 static_cast<JSGlobalAlternate*>(GetEmbedObject()); | 92 static_cast<JSGlobalAlternate*>(GetEmbedObject()); |
| 93 pGlobal->Initial(pRuntime->GetReaderApp()); | 93 pGlobal->Initial(pRuntime->GetReaderApp()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 JSGlobalData::JSGlobalData() |
| 97 : nType(0), |
| 98 dData(0), |
| 99 bData(FALSE), |
| 100 sData(""), |
| 101 bPersistent(FALSE), |
| 102 bDeleted(FALSE) {} |
| 103 |
| 104 JSGlobalData::~JSGlobalData() { |
| 105 pData.Reset(); |
| 106 } |
| 107 |
| 96 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) | 108 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) |
| 97 : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {} | 109 : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {} |
| 98 | 110 |
| 99 JSGlobalAlternate::~JSGlobalAlternate() { | 111 JSGlobalAlternate::~JSGlobalAlternate() { |
| 100 DestroyGlobalPersisitentVariables(); | 112 DestroyGlobalPersisitentVariables(); |
| 101 m_pGlobalData->Release(); | 113 m_pGlobalData->Release(); |
| 102 } | 114 } |
| 103 | 115 |
| 104 void JSGlobalAlternate::Initial(CPDFDoc_Environment* pApp) { | 116 void JSGlobalAlternate::Initial(CPDFDoc_Environment* pApp) { |
| 105 m_pApp = pApp; | 117 m_pApp = pApp; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 return CJS_Value::VT_boolean; | 516 return CJS_Value::VT_boolean; |
| 505 if (nHash == JSCONST_nDateHash) | 517 if (nHash == JSCONST_nDateHash) |
| 506 return CJS_Value::VT_date; | 518 return CJS_Value::VT_date; |
| 507 if (nHash == JSCONST_nObjectHash) | 519 if (nHash == JSCONST_nObjectHash) |
| 508 return CJS_Value::VT_object; | 520 return CJS_Value::VT_object; |
| 509 if (nHash == JSCONST_nFXobjHash) | 521 if (nHash == JSCONST_nFXobjHash) |
| 510 return CJS_Value::VT_fxobject; | 522 return CJS_Value::VT_fxobject; |
| 511 | 523 |
| 512 return CJS_Value::VT_unknown; | 524 return CJS_Value::VT_unknown; |
| 513 } | 525 } |
| OLD | NEW |