| 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 "xfa/fxjse/class.h" | 7 #include "xfa/fxjse/class.h" |
| 8 | 8 |
| 9 #include "xfa/fxjse/cfxjse_arguments.h" | 9 #include "xfa/fxjse/cfxjse_arguments.h" |
| 10 #include "xfa/fxjse/context.h" | 10 #include "xfa/fxjse/context.h" |
| 11 #include "xfa/fxjse/scope_inline.h" | 11 #include "xfa/fxjse/scope_inline.h" |
| 12 #include "xfa/fxjse/util_inline.h" | 12 #include "xfa/fxjse/util_inline.h" |
| 13 #include "xfa/fxjse/value.h" | 13 #include "xfa/fxjse/value.h" |
| 14 | 14 |
| 15 static void FXJSE_V8ConstructorCallback_Wrapper( | 15 static void FXJSE_V8ConstructorCallback_Wrapper( |
| 16 const v8::FunctionCallbackInfo<v8::Value>& info); | 16 const v8::FunctionCallbackInfo<v8::Value>& info); |
| 17 static void FXJSE_V8FunctionCallback_Wrapper( | 17 static void FXJSE_V8FunctionCallback_Wrapper( |
| 18 const v8::FunctionCallbackInfo<v8::Value>& info); | 18 const v8::FunctionCallbackInfo<v8::Value>& info); |
| 19 static void FXJSE_V8GetterCallback_Wrapper( | 19 static void FXJSE_V8GetterCallback_Wrapper( |
| 20 v8::Local<v8::String> property, | 20 v8::Local<v8::String> property, |
| 21 const v8::PropertyCallbackInfo<v8::Value>& info); | 21 const v8::PropertyCallbackInfo<v8::Value>& info); |
| 22 static void FXJSE_V8SetterCallback_Wrapper( | 22 static void FXJSE_V8SetterCallback_Wrapper( |
| 23 v8::Local<v8::String> property, | 23 v8::Local<v8::String> property, |
| 24 v8::Local<v8::Value> value, | 24 v8::Local<v8::Value> value, |
| 25 const v8::PropertyCallbackInfo<void>& info); | 25 const v8::PropertyCallbackInfo<void>& info); |
| 26 | 26 |
| 27 FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, | 27 FXJSE_HCLASS FXJSE_DefineClass(CFXJSE_Context* pContext, |
| 28 const FXJSE_CLASS* lpClass) { | 28 const FXJSE_CLASS* lpClass) { |
| 29 CFXJSE_Context* lpContext = reinterpret_cast<CFXJSE_Context*>(hContext); | 29 ASSERT(pContext); |
| 30 ASSERT(lpContext); | |
| 31 return reinterpret_cast<FXJSE_HCLASS>( | 30 return reinterpret_cast<FXJSE_HCLASS>( |
| 32 CFXJSE_Class::Create(lpContext, lpClass, FALSE)); | 31 CFXJSE_Class::Create(pContext, lpClass, FALSE)); |
| 33 } | 32 } |
| 34 | 33 |
| 35 static void FXJSE_V8FunctionCallback_Wrapper( | 34 static void FXJSE_V8FunctionCallback_Wrapper( |
| 36 const v8::FunctionCallbackInfo<v8::Value>& info) { | 35 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 37 const FXJSE_FUNCTION* lpFunctionInfo = | 36 const FXJSE_FUNCTION* lpFunctionInfo = |
| 38 static_cast<FXJSE_FUNCTION*>(info.Data().As<v8::External>()->Value()); | 37 static_cast<FXJSE_FUNCTION*>(info.Data().As<v8::External>()->Value()); |
| 39 if (!lpFunctionInfo) { | 38 if (!lpFunctionInfo) { |
| 40 return; | 39 return; |
| 41 } | 40 } |
| 42 CFX_ByteStringC szFunctionName(lpFunctionInfo->name); | 41 CFX_ByteStringC szFunctionName(lpFunctionInfo->name); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 308 } |
| 310 | 309 |
| 311 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, | 310 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, |
| 312 const CFX_ByteStringC& szName) { | 311 const CFX_ByteStringC& szName) { |
| 313 for (const auto& pClass : pContext->m_rgClasses) { | 312 for (const auto& pClass : pContext->m_rgClasses) { |
| 314 if (pClass->m_szClassName == szName) | 313 if (pClass->m_szClassName == szName) |
| 315 return pClass.get(); | 314 return pClass.get(); |
| 316 } | 315 } |
| 317 return nullptr; | 316 return nullptr; |
| 318 } | 317 } |
| OLD | NEW |