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" |
11 | 11 |
12 class CXFA_FM2JSContext; | |
13 class CXFA_Node; | |
14 class CXFA_Object; | |
15 class CXFA_ThisProxy; | |
16 | |
12 class CFXJSE_Value { | 17 class CFXJSE_Value { |
13 public: | 18 public: |
14 CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} | 19 CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} |
15 | 20 |
16 V8_INLINE FX_BOOL IsUndefined() const { | 21 V8_INLINE FX_BOOL IsUndefined() const { |
17 if (m_hValue.IsEmpty()) { | 22 if (m_hValue.IsEmpty()) { |
18 return FALSE; | 23 return FALSE; |
19 } | 24 } |
20 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 25 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
21 v8::Local<v8::Value> hValue = | 26 v8::Local<v8::Value> hValue = |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 } | 139 } |
135 V8_INLINE void ToString(CFX_ByteString& szStrOutput) const { | 140 V8_INLINE void ToString(CFX_ByteString& szStrOutput) const { |
136 ASSERT(!m_hValue.IsEmpty()); | 141 ASSERT(!m_hValue.IsEmpty()); |
137 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 142 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); |
138 v8::Local<v8::Value> hValue = | 143 v8::Local<v8::Value> hValue = |
139 v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 144 v8::Local<v8::Value>::New(m_pIsolate, m_hValue); |
140 v8::Local<v8::String> hString = hValue->ToString(); | 145 v8::Local<v8::String> hString = hValue->ToString(); |
141 v8::String::Utf8Value hStringVal(hString); | 146 v8::String::Utf8Value hStringVal(hString); |
142 szStrOutput = *hStringVal; | 147 szStrOutput = *hStringVal; |
143 } | 148 } |
144 CFXJSE_HostObject* ToObject(CFXJSE_Class* lpClass) const; | 149 CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; |
150 CXFA_Object* ToObject(CFXJSE_Class* lpClass) const; | |
Tom Sepez
2016/06/01 20:17:58
Layering violation. I think you're stuck with ToH
dsinclair
2016/06/01 20:34:31
Why is this a violation? CXFA_Object is defined in
| |
151 CXFA_Node* ToNode(CFXJSE_Class* lpClass) const; | |
152 CXFA_FM2JSContext* ToJSContext(CFXJSE_Class* lpClass) const; | |
153 CXFA_ThisProxy* ToProxy(CFXJSE_Class* lpClass) const; | |
145 | 154 |
146 V8_INLINE void SetUndefined() { | 155 V8_INLINE void SetUndefined() { |
147 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 156 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
148 v8::Local<v8::Value> hValue = v8::Undefined(m_pIsolate); | 157 v8::Local<v8::Value> hValue = v8::Undefined(m_pIsolate); |
149 m_hValue.Reset(m_pIsolate, hValue); | 158 m_hValue.Reset(m_pIsolate, hValue); |
150 } | 159 } |
151 V8_INLINE void SetNull() { | 160 V8_INLINE void SetNull() { |
152 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 161 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
153 v8::Local<v8::Value> hValue = v8::Null(m_pIsolate); | 162 v8::Local<v8::Value> hValue = v8::Null(m_pIsolate); |
154 m_hValue.Reset(m_pIsolate, hValue); | 163 m_hValue.Reset(m_pIsolate, hValue); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 233 |
225 CFXJSE_Value(); | 234 CFXJSE_Value(); |
226 CFXJSE_Value(const CFXJSE_Value&); | 235 CFXJSE_Value(const CFXJSE_Value&); |
227 CFXJSE_Value& operator=(const CFXJSE_Value&); | 236 CFXJSE_Value& operator=(const CFXJSE_Value&); |
228 | 237 |
229 v8::Isolate* m_pIsolate; | 238 v8::Isolate* m_pIsolate; |
230 v8::Global<v8::Value> m_hValue; | 239 v8::Global<v8::Value> m_hValue; |
231 }; | 240 }; |
232 | 241 |
233 #endif // XFA_FXJSE_VALUE_H_ | 242 #endif // XFA_FXJSE_VALUE_H_ |
OLD | NEW |