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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_EventHandler.h" | 9 #include "../../include/javascript/JS_EventHandler.h" |
10 #include "../../include/javascript/JS_Runtime.h" | 10 #include "../../include/javascript/JS_Runtime.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 delete (CJS_Runtime*)pRuntime; | 68 delete (CJS_Runtime*)pRuntime; |
69 } | 69 } |
70 | 70 |
71 CJS_GlobalData* CJS_RuntimeFactory::NewGlobalData(CPDFDoc_Environment* pApp) | 71 CJS_GlobalData* CJS_RuntimeFactory::NewGlobalData(CPDFDoc_Environment* pApp) |
72 { | 72 { |
73 if (m_pGlobalData) | 73 if (m_pGlobalData) |
74 { | 74 { |
75 m_nGlobalDataCount++; | 75 m_nGlobalDataCount++; |
76 return m_pGlobalData; | 76 return m_pGlobalData; |
77 } | 77 } |
78 » else | 78 m_nGlobalDataCount = 1; |
79 » { | 79 m_pGlobalData = new CJS_GlobalData(pApp); |
80 » » m_nGlobalDataCount = 1; | 80 return m_pGlobalData; |
81 » » m_pGlobalData = new CJS_GlobalData(pApp); | |
82 » » return m_pGlobalData; | |
83 » } | |
84 } | 81 } |
85 | 82 |
86 void CJS_RuntimeFactory::ReleaseGlobalData() | 83 void CJS_RuntimeFactory::ReleaseGlobalData() |
87 { | 84 { |
88 m_nGlobalDataCount--; | 85 m_nGlobalDataCount--; |
89 | 86 |
90 if (m_nGlobalDataCount <= 0) | 87 if (m_nGlobalDataCount <= 0) |
91 { | 88 { |
92 delete m_pGlobalData; | 89 delete m_pGlobalData; |
93 m_pGlobalData = NULL; | 90 m_pGlobalData = NULL; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 { | 338 { |
342 return v8::Local<v8::Context>::New(m_isolate, m_context); | 339 return v8::Local<v8::Context>::New(m_isolate, m_context); |
343 } | 340 } |
344 | 341 |
345 CFX_WideString ChangeObjName(const CFX_WideString& str) | 342 CFX_WideString ChangeObjName(const CFX_WideString& str) |
346 { | 343 { |
347 CFX_WideString sRet = str; | 344 CFX_WideString sRet = str; |
348 sRet.Replace(L"_", L"."); | 345 sRet.Replace(L"_", L"."); |
349 return sRet; | 346 return sRet; |
350 } | 347 } |
OLD | NEW |