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 #ifndef XFA_FXJSE_VALUE_H_ | 7 #ifndef XFA_FXJSE_VALUE_H_ |
8 #define XFA_FXJSE_VALUE_H_ | 8 #define XFA_FXJSE_VALUE_H_ |
9 | 9 |
10 #include "xfa/fxjse/scope_inline.h" | 10 #include "xfa/fxjse/scope_inline.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 m_hValue.Reset(m_pIsolate, hValue); | 173 m_hValue.Reset(m_pIsolate, hValue); |
174 } | 174 } |
175 V8_INLINE void SetDouble(double dDouble) { | 175 V8_INLINE void SetDouble(double dDouble) { |
176 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 176 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
177 v8::Local<v8::Value> hValue = v8::Number::New(m_pIsolate, dDouble); | 177 v8::Local<v8::Value> hValue = v8::Number::New(m_pIsolate, dDouble); |
178 m_hValue.Reset(m_pIsolate, hValue); | 178 m_hValue.Reset(m_pIsolate, hValue); |
179 } | 179 } |
180 V8_INLINE void SetString(const CFX_ByteStringC& szString) { | 180 V8_INLINE void SetString(const CFX_ByteStringC& szString) { |
181 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 181 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
182 v8::Local<v8::Value> hValue = v8::String::NewFromUtf8( | 182 v8::Local<v8::Value> hValue = v8::String::NewFromUtf8( |
183 m_pIsolate, reinterpret_cast<const char*>(szString.GetPtr()), | 183 m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()), |
184 v8::String::kNormalString, szString.GetLength()); | 184 v8::String::kNormalString, szString.GetLength()); |
185 m_hValue.Reset(m_pIsolate, hValue); | 185 m_hValue.Reset(m_pIsolate, hValue); |
186 } | 186 } |
187 V8_INLINE void SetFloat(FX_FLOAT fFloat); | 187 V8_INLINE void SetFloat(FX_FLOAT fFloat); |
188 V8_INLINE void SetJSObject() { | 188 V8_INLINE void SetJSObject() { |
189 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 189 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); |
190 v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); | 190 v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); |
191 m_hValue.Reset(m_pIsolate, hValue); | 191 m_hValue.Reset(m_pIsolate, hValue); |
192 } | 192 } |
193 void SetHostObject(void* lpObject, CFXJSE_Class* lpClass); | 193 void SetHostObject(void* lpObject, CFXJSE_Class* lpClass); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 static CFXJSE_Value* Create(v8::Isolate* pIsolate); | 232 static CFXJSE_Value* Create(v8::Isolate* pIsolate); |
233 | 233 |
234 protected: | 234 protected: |
235 v8::Isolate* m_pIsolate; | 235 v8::Isolate* m_pIsolate; |
236 v8::Global<v8::Value> m_hValue; | 236 v8::Global<v8::Value> m_hValue; |
237 friend class CFXJSE_Context; | 237 friend class CFXJSE_Context; |
238 friend class CFXJSE_Class; | 238 friend class CFXJSE_Class; |
239 }; | 239 }; |
240 | 240 |
241 #endif // XFA_FXJSE_VALUE_H_ | 241 #endif // XFA_FXJSE_VALUE_H_ |
OLD | NEW |