| 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/JS_GlobalData.h" | 7 #include "fpdfsdk/javascript/JS_GlobalData.h" |
| 8 | 8 |
| 9 #include "core/fdrm/crypto/include/fx_crypt.h" | 9 #include "core/fdrm/crypto/include/fx_crypt.h" |
| 10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 0x0e, 0xd0, 0x6b, 0xbb, 0xd5, 0x75, 0x55, 0x8b, 0x6e, 0x6b, 0x19, 0xa0, | 93 0x0e, 0xd0, 0x6b, 0xbb, 0xd5, 0x75, 0x55, 0x8b, 0x6e, 0x6b, 0x19, 0xa0, |
| 94 0xf8, 0x77, 0xd5, 0xa3}; | 94 0xf8, 0x77, 0xd5, 0xa3}; |
| 95 | 95 |
| 96 // Returns true if non-empty, setting sPropName | 96 // Returns true if non-empty, setting sPropName |
| 97 static bool TrimPropName(CFX_ByteString* sPropName) { | 97 static bool TrimPropName(CFX_ByteString* sPropName) { |
| 98 sPropName->TrimLeft(); | 98 sPropName->TrimLeft(); |
| 99 sPropName->TrimRight(); | 99 sPropName->TrimRight(); |
| 100 return sPropName->GetLength() != 0; | 100 return sPropName->GetLength() != 0; |
| 101 } | 101 } |
| 102 | 102 |
| 103 CJS_GlobalData* CJS_GlobalData::g_Instance = nullptr; | 103 CJS_GlobalData* CJS_GlobalData::m_pInstance = nullptr; |
| 104 | 104 |
| 105 // static | 105 // static |
| 106 CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(CPDFDoc_Environment* pApp) { | 106 CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(CPDFDoc_Environment* pApp) { |
| 107 if (!g_Instance) { | 107 if (!m_pInstance) { |
| 108 g_Instance = new CJS_GlobalData(); | 108 m_pInstance = new CJS_GlobalData(); |
| 109 } | 109 } |
| 110 ++g_Instance->m_RefCount; | 110 ++m_pInstance->m_RefCount; |
| 111 return g_Instance; | 111 return m_pInstance; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void CJS_GlobalData::Release() { | 114 void CJS_GlobalData::Release() { |
| 115 if (!--m_RefCount) { | 115 if (!--m_RefCount) { |
| 116 delete g_Instance; | 116 delete m_pInstance; |
| 117 g_Instance = nullptr; | 117 m_pInstance = nullptr; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 CJS_GlobalData::CJS_GlobalData() | 121 CJS_GlobalData::CJS_GlobalData() |
| 122 : m_RefCount(0), m_sFilePath(SDK_JS_GLOBALDATA_FILENAME) { | 122 : m_RefCount(0), m_sFilePath(SDK_JS_GLOBALDATA_FILENAME) { |
| 123 LoadGlobalPersistentVariables(); | 123 LoadGlobalPersistentVariables(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 CJS_GlobalData::~CJS_GlobalData() { | 126 CJS_GlobalData::~CJS_GlobalData() { |
| 127 SaveGlobalPersisitentVariables(); | 127 SaveGlobalPersisitentVariables(); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 sData.AppendBlock(&wType, sizeof(uint32_t)); | 450 sData.AppendBlock(&wType, sizeof(uint32_t)); |
| 451 } break; | 451 } break; |
| 452 default: | 452 default: |
| 453 break; | 453 break; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 CJS_KeyValue::CJS_KeyValue() {} | 457 CJS_KeyValue::CJS_KeyValue() {} |
| 458 | 458 |
| 459 CJS_KeyValue::~CJS_KeyValue() {} | 459 CJS_KeyValue::~CJS_KeyValue() {} |
| OLD | NEW |