| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 165         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 165         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 
| 166     return static_cast<double>(hValue->NumberValue()); | 166     return static_cast<double>(hValue->NumberValue()); | 
| 167   } | 167   } | 
| 168   V8_INLINE int32_t ToInteger() const { | 168   V8_INLINE int32_t ToInteger() const { | 
| 169     ASSERT(!m_hValue.IsEmpty()); | 169     ASSERT(!m_hValue.IsEmpty()); | 
| 170     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 170     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 
| 171     v8::Local<v8::Value> hValue = | 171     v8::Local<v8::Value> hValue = | 
| 172         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 172         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 
| 173     return static_cast<int32_t>(hValue->NumberValue()); | 173     return static_cast<int32_t>(hValue->NumberValue()); | 
| 174   } | 174   } | 
| 175   V8_INLINE void ToString(CFX_ByteString& szStrOutput) const { | 175   V8_INLINE CFX_ByteString ToString() const { | 
| 176     ASSERT(!m_hValue.IsEmpty()); | 176     ASSERT(!m_hValue.IsEmpty()); | 
| 177     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 177     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 
| 178     v8::Local<v8::Value> hValue = | 178     v8::Local<v8::Value> hValue = | 
| 179         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 179         v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 
| 180     v8::Local<v8::String> hString = hValue->ToString(); | 180     v8::Local<v8::String> hString = hValue->ToString(); | 
| 181     v8::String::Utf8Value hStringVal(hString); | 181     v8::String::Utf8Value hStringVal(hString); | 
| 182     szStrOutput = *hStringVal; | 182     return CFX_ByteString(*hStringVal); | 
|  | 183   } | 
|  | 184   V8_INLINE CFX_WideString ToWideString() const { | 
|  | 185     return CFX_WideString::FromUTF8(ToString().AsStringC()); | 
| 183   } | 186   } | 
| 184   CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; | 187   CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; | 
| 185 | 188 | 
| 186   V8_INLINE void SetUndefined() { | 189   V8_INLINE void SetUndefined() { | 
| 187     CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 190     CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 
| 188     v8::Local<v8::Value> hValue = v8::Undefined(m_pIsolate); | 191     v8::Local<v8::Value> hValue = v8::Undefined(m_pIsolate); | 
| 189     m_hValue.Reset(m_pIsolate, hValue); | 192     m_hValue.Reset(m_pIsolate, hValue); | 
| 190   } | 193   } | 
| 191   V8_INLINE void SetNull() { | 194   V8_INLINE void SetNull() { | 
| 192     CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 195     CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 272 | 275 | 
| 273   CFXJSE_Value(); | 276   CFXJSE_Value(); | 
| 274   CFXJSE_Value(const CFXJSE_Value&); | 277   CFXJSE_Value(const CFXJSE_Value&); | 
| 275   CFXJSE_Value& operator=(const CFXJSE_Value&); | 278   CFXJSE_Value& operator=(const CFXJSE_Value&); | 
| 276 | 279 | 
| 277   v8::Isolate* m_pIsolate; | 280   v8::Isolate* m_pIsolate; | 
| 278   v8::Global<v8::Value> m_hValue; | 281   v8::Global<v8::Value> m_hValue; | 
| 279 }; | 282 }; | 
| 280 | 283 | 
| 281 #endif  // XFA_FXJSE_VALUE_H_ | 284 #endif  // XFA_FXJSE_VALUE_H_ | 
| OLD | NEW | 
|---|