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/value.h" | 7 #include "xfa/fxjse/value.h" |
8 | 8 |
9 #include <math.h> | 9 #include <math.h> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue, | 58 void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue, |
59 CFX_ByteString& szStrOutput) { | 59 CFX_ByteString& szStrOutput) { |
60 pValue->ToString(szStrOutput); | 60 pValue->ToString(szStrOutput); |
61 } | 61 } |
62 | 62 |
63 int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue) { | 63 int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue) { |
64 return pValue->ToInteger(); | 64 return pValue->ToInteger(); |
65 } | 65 } |
66 | 66 |
67 CFXJSE_HostObject* FXJSE_Value_ToObject(CFXJSE_Value* pValue, | |
68 CFXJSE_Class* pClass) { | |
69 return pValue->ToObject(pClass); | |
70 } | |
71 | |
72 void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue) { | 67 void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue) { |
73 pValue->SetUndefined(); | 68 pValue->SetUndefined(); |
74 } | 69 } |
75 | 70 |
76 void FXJSE_Value_SetNull(CFXJSE_Value* pValue) { | 71 void FXJSE_Value_SetNull(CFXJSE_Value* pValue) { |
77 pValue->SetNull(); | 72 pValue->SetNull(); |
78 } | 73 } |
79 | 74 |
80 void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean) { | 75 void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean) { |
81 pValue->SetBoolean(bBoolean); | 76 pValue->SetBoolean(bBoolean); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 hError.As<v8::Object>()->Set( | 186 hError.As<v8::Object>()->Set( |
192 v8::String::NewFromUtf8(pIsolate, "name"), | 187 v8::String::NewFromUtf8(pIsolate, "name"), |
193 v8::String::NewFromUtf8(pIsolate, utf8Name.c_str(), | 188 v8::String::NewFromUtf8(pIsolate, utf8Name.c_str(), |
194 v8::String::kNormalString, | 189 v8::String::kNormalString, |
195 utf8Name.GetLength())); | 190 utf8Name.GetLength())); |
196 } | 191 } |
197 } | 192 } |
198 pIsolate->ThrowException(hError); | 193 pIsolate->ThrowException(hError); |
199 } | 194 } |
200 | 195 |
201 CFXJSE_HostObject* CFXJSE_Value::ToObject(CFXJSE_Class* lpClass) const { | 196 CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const { |
202 ASSERT(!m_hValue.IsEmpty()); | 197 ASSERT(!m_hValue.IsEmpty()); |
203 | 198 |
204 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 199 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); |
205 v8::Local<v8::Value> pValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 200 v8::Local<v8::Value> pValue = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); |
206 ASSERT(!pValue.IsEmpty()); | 201 ASSERT(!pValue.IsEmpty()); |
207 | 202 |
208 if (!pValue->IsObject()) | 203 if (!pValue->IsObject()) |
209 return nullptr; | 204 return nullptr; |
210 | 205 |
211 return FXJSE_RetrieveObjectBinding(pValue.As<v8::Object>(), lpClass); | 206 return FXJSE_RetrieveObjectBinding(pValue.As<v8::Object>(), lpClass); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 if (lpRetValue) | 489 if (lpRetValue) |
495 lpRetValue->ForceSetValue(hReturnValue); | 490 lpRetValue->ForceSetValue(hReturnValue); |
496 | 491 |
497 if (lpLocalArgs) { | 492 if (lpLocalArgs) { |
498 for (uint32_t i = 0; i < nArgCount; i++) | 493 for (uint32_t i = 0; i < nArgCount; i++) |
499 lpLocalArgs[i].~Local(); | 494 lpLocalArgs[i].~Local(); |
500 FX_Free(lpLocalArgs); | 495 FX_Free(lpLocalArgs); |
501 } | 496 } |
502 return bRetValue; | 497 return bRetValue; |
503 } | 498 } |
OLD | NEW |