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 "fxjse/include/cfxjse_class.h" | 7 #include "fxjse/include/cfxjse_class.h" |
8 | 8 |
9 #include "fxjse/context.h" | 9 #include "fxjse/context.h" |
10 #include "fxjse/include/cfxjse_arguments.h" | 10 #include "fxjse/include/cfxjse_arguments.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 v8::FunctionTemplate::New( | 265 v8::FunctionTemplate::New( |
266 pIsolate, FXJSE_Context_GlobalObjToString, | 266 pIsolate, FXJSE_Context_GlobalObjToString, |
267 v8::External::New(pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>( | 267 v8::External::New(pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>( |
268 lpClassDefinition)))); | 268 lpClassDefinition)))); |
269 } | 269 } |
270 pClass->m_hTemplate.Reset(lpContext->m_pIsolate, hFunctionTemplate); | 270 pClass->m_hTemplate.Reset(lpContext->m_pIsolate, hFunctionTemplate); |
271 lpContext->m_rgClasses.push_back(std::unique_ptr<CFXJSE_Class>(pClass)); | 271 lpContext->m_rgClasses.push_back(std::unique_ptr<CFXJSE_Class>(pClass)); |
272 return pClass; | 272 return pClass; |
273 } | 273 } |
274 | 274 |
| 275 CFXJSE_Class::CFXJSE_Class(CFXJSE_Context* lpContext) |
| 276 : m_lpClassDefinition(nullptr), m_pContext(lpContext) {} |
| 277 |
| 278 CFXJSE_Class::~CFXJSE_Class() {} |
| 279 |
275 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, | 280 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, |
276 const CFX_ByteStringC& szName) { | 281 const CFX_ByteStringC& szName) { |
277 for (const auto& pClass : pContext->m_rgClasses) { | 282 for (const auto& pClass : pContext->m_rgClasses) { |
278 if (pClass->m_szClassName == szName) | 283 if (pClass->m_szClassName == szName) |
279 return pClass.get(); | 284 return pClass.get(); |
280 } | 285 } |
281 return nullptr; | 286 return nullptr; |
282 } | 287 } |
OLD | NEW |