| 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 "global.h" | 7 #include "global.h" |
| 8 | 8 |
| 9 #include "../../../core/include/fxcrt/fx_ext.h" | 9 #include "../../../core/include/fxcrt/fx_ext.h" |
| 10 #include "../../include/javascript/IJavaScript.h" | 10 #include "../../include/javascript/IJavaScript.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 BEGIN_JS_STATIC_PROP(CJS_Global) | 81 BEGIN_JS_STATIC_PROP(CJS_Global) |
| 82 END_JS_STATIC_PROP() | 82 END_JS_STATIC_PROP() |
| 83 | 83 |
| 84 BEGIN_JS_STATIC_METHOD(CJS_Global) | 84 BEGIN_JS_STATIC_METHOD(CJS_Global) |
| 85 JS_STATIC_METHOD_ENTRY(setPersistent) | 85 JS_STATIC_METHOD_ENTRY(setPersistent) |
| 86 END_JS_STATIC_METHOD() | 86 END_JS_STATIC_METHOD() |
| 87 | 87 |
| 88 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); | 88 IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global); |
| 89 | 89 |
| 90 FX_BOOL CJS_Global::InitInstance(IJS_Context* cc) { | 90 void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) { |
| 91 CJS_Context* pContext = (CJS_Context*)cc; | 91 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>(pIRuntime); |
| 92 ASSERT(pContext != NULL); | 92 JSGlobalAlternate* pGlobal = |
| 93 | 93 static_cast<JSGlobalAlternate*>(GetEmbedObject()); |
| 94 JSGlobalAlternate* pGlobal = (JSGlobalAlternate*)GetEmbedObject(); | 94 pGlobal->Initial(pRuntime->GetReaderApp()); |
| 95 ASSERT(pGlobal != NULL); | 95 } |
| 96 | |
| 97 pGlobal->Initial(pContext->GetReaderApp()); | |
| 98 | |
| 99 return TRUE; | |
| 100 }; | |
| 101 | 96 |
| 102 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) | 97 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) |
| 103 : CJS_EmbedObj(pJSObject), m_pApp(NULL) { | 98 : CJS_EmbedObj(pJSObject), m_pApp(NULL) { |
| 104 } | 99 } |
| 105 | 100 |
| 106 JSGlobalAlternate::~JSGlobalAlternate() { | 101 JSGlobalAlternate::~JSGlobalAlternate() { |
| 107 DestroyGlobalPersisitentVariables(); | 102 DestroyGlobalPersisitentVariables(); |
| 108 m_pGlobalData->Release(); | 103 m_pGlobalData->Release(); |
| 109 } | 104 } |
| 110 | 105 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 return CJS_Value::VT_boolean; | 519 return CJS_Value::VT_boolean; |
| 525 if (nHash == JSCONST_nDateHash) | 520 if (nHash == JSCONST_nDateHash) |
| 526 return CJS_Value::VT_date; | 521 return CJS_Value::VT_date; |
| 527 if (nHash == JSCONST_nObjectHash) | 522 if (nHash == JSCONST_nObjectHash) |
| 528 return CJS_Value::VT_object; | 523 return CJS_Value::VT_object; |
| 529 if (nHash == JSCONST_nFXobjHash) | 524 if (nHash == JSCONST_nFXobjHash) |
| 530 return CJS_Value::VT_fxobject; | 525 return CJS_Value::VT_fxobject; |
| 531 | 526 |
| 532 return CJS_Value::VT_unknown; | 527 return CJS_Value::VT_unknown; |
| 533 } | 528 } |
| OLD | NEW |