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" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const { | 178 CFX_ByteString CFXJSE_Arguments::GetUTF8String(int32_t index) const { |
179 const CFXJSE_ArgumentsImpl* lpArguments = | 179 const CFXJSE_ArgumentsImpl* lpArguments = |
180 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); | 180 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); |
181 v8::Local<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString(); | 181 v8::Local<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString(); |
182 v8::String::Utf8Value szStringVal(hString); | 182 v8::String::Utf8Value szStringVal(hString); |
183 return CFX_ByteString(*szStringVal); | 183 return CFX_ByteString(*szStringVal); |
184 } | 184 } |
185 | 185 |
186 void* CFXJSE_Arguments::GetObject(int32_t index) const { | 186 void* CFXJSE_Arguments::GetObject(int32_t index, FXJSE_HCLASS hClass) const { |
187 const CFXJSE_ArgumentsImpl* lpArguments = | 187 const CFXJSE_ArgumentsImpl* lpArguments = |
188 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); | 188 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); |
189 v8::Local<v8::Value> hValue = (*lpArguments->m_pInfo)[index]; | 189 v8::Local<v8::Value> hValue = (*lpArguments->m_pInfo)[index]; |
190 ASSERT(!hValue.IsEmpty()); | 190 ASSERT(!hValue.IsEmpty()); |
191 if (!hValue->IsObject()) { | 191 if (!hValue->IsObject()) { |
192 return NULL; | 192 return NULL; |
193 } | 193 } |
194 return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>()); | 194 CFXJSE_Class* lpClass = reinterpret_cast<CFXJSE_Class*>(hClass); |
| 195 return FXJSE_RetrieveObjectBinding(hValue.As<v8::Object>(), lpClass); |
195 } | 196 } |
196 | 197 |
197 FXJSE_HVALUE CFXJSE_Arguments::GetReturnValue() { | 198 FXJSE_HVALUE CFXJSE_Arguments::GetReturnValue() { |
198 const CFXJSE_ArgumentsImpl* lpArguments = | 199 const CFXJSE_ArgumentsImpl* lpArguments = |
199 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); | 200 reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this); |
200 return reinterpret_cast<FXJSE_HVALUE>(lpArguments->m_pRetValue); | 201 return reinterpret_cast<FXJSE_HVALUE>(lpArguments->m_pRetValue); |
201 } | 202 } |
202 static void FXJSE_Context_GlobalObjToString( | 203 static void FXJSE_Context_GlobalObjToString( |
203 const v8::FunctionCallbackInfo<v8::Value>& info) { | 204 const v8::FunctionCallbackInfo<v8::Value>& info) { |
204 const FXJSE_CLASS* lpClass = | 205 const FXJSE_CLASS* lpClass = |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 309 } |
309 | 310 |
310 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, | 311 CFXJSE_Class* CFXJSE_Class::GetClassFromContext(CFXJSE_Context* pContext, |
311 const CFX_ByteStringC& szName) { | 312 const CFX_ByteStringC& szName) { |
312 for (const auto& pClass : pContext->m_rgClasses) { | 313 for (const auto& pClass : pContext->m_rgClasses) { |
313 if (pClass->m_szClassName == szName) | 314 if (pClass->m_szClassName == szName) |
314 return pClass.get(); | 315 return pClass.get(); |
315 } | 316 } |
316 return nullptr; | 317 return nullptr; |
317 } | 318 } |
OLD | NEW |