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/value.h" | 12 #include "xfa/fxjse/value.h" |
13 | 13 |
14 static void FXJSE_V8ConstructorCallback_Wrapper( | 14 static void FXJSE_V8ConstructorCallback_Wrapper( |
15 const v8::FunctionCallbackInfo<v8::Value>& info); | 15 const v8::FunctionCallbackInfo<v8::Value>& info); |
16 static void FXJSE_V8FunctionCallback_Wrapper( | 16 static void FXJSE_V8FunctionCallback_Wrapper( |
17 const v8::FunctionCallbackInfo<v8::Value>& info); | 17 const v8::FunctionCallbackInfo<v8::Value>& info); |
18 static void FXJSE_V8GetterCallback_Wrapper( | 18 static void FXJSE_V8GetterCallback_Wrapper( |
19 v8::Local<v8::String> property, | 19 v8::Local<v8::String> property, |
20 const v8::PropertyCallbackInfo<v8::Value>& info); | 20 const v8::PropertyCallbackInfo<v8::Value>& info); |
21 static void FXJSE_V8SetterCallback_Wrapper( | 21 static void FXJSE_V8SetterCallback_Wrapper( |
22 v8::Local<v8::String> property, | 22 v8::Local<v8::String> property, |
23 v8::Local<v8::Value> value, | 23 v8::Local<v8::Value> value, |
24 const v8::PropertyCallbackInfo<void>& info); | 24 const v8::PropertyCallbackInfo<void>& info); |
25 | 25 |
26 CFXJSE_Class* FXJSE_DefineClass(CFXJSE_Context* pContext, | |
27 const FXJSE_CLASS_DESCRIPTOR* lpClass) { | |
28 ASSERT(pContext); | |
29 return CFXJSE_Class::Create(pContext, lpClass, FALSE); | |
30 } | |
31 | |
32 static void FXJSE_V8FunctionCallback_Wrapper( | 26 static void FXJSE_V8FunctionCallback_Wrapper( |
33 const v8::FunctionCallbackInfo<v8::Value>& info) { | 27 const v8::FunctionCallbackInfo<v8::Value>& info) { |
34 const FXJSE_FUNCTION_DESCRIPTOR* lpFunctionInfo = | 28 const FXJSE_FUNCTION_DESCRIPTOR* lpFunctionInfo = |
35 static_cast<FXJSE_FUNCTION_DESCRIPTOR*>( | 29 static_cast<FXJSE_FUNCTION_DESCRIPTOR*>( |
36 info.Data().As<v8::External>()->Value()); | 30 info.Data().As<v8::External>()->Value()); |
37 if (!lpFunctionInfo) { | 31 if (!lpFunctionInfo) { |
38 return; | 32 return; |
39 } | 33 } |
40 CFX_ByteStringC szFunctionName(lpFunctionInfo->name); | 34 CFX_ByteStringC szFunctionName(lpFunctionInfo->name); |
41 std::unique_ptr<CFXJSE_Value> lpThisValue( | 35 std::unique_ptr<CFXJSE_Value> lpThisValue( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 272 } |
279 | 273 |
280 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, | 274 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, |
281 const CFX_ByteStringC& szName) { | 275 const CFX_ByteStringC& szName) { |
282 for (const auto& pClass : pContext->m_rgClasses) { | 276 for (const auto& pClass : pContext->m_rgClasses) { |
283 if (pClass->m_szClassName == szName) | 277 if (pClass->m_szClassName == szName) |
284 return pClass.get(); | 278 return pClass.get(); |
285 } | 279 } |
286 return nullptr; | 280 return nullptr; |
287 } | 281 } |
OLD | NEW |