52
inline void gcProtect(JSValuePtr value)
52
inline void gcProtect(JSValue value)
54
54
if (value && value.isCell())
55
55
gcProtect(asCell(value));
58
inline void gcUnprotect(JSValuePtr value)
58
inline void gcUnprotect(JSValue value)
60
60
if (value && value.isCell())
61
61
gcUnprotect(asCell(value));
75
75
T* get() const { return m_ptr; }
76
76
operator T*() const { return m_ptr; }
77
operator JSValuePtr() const { return JSValuePtr(m_ptr); }
77
operator JSValue() const { return JSValue(m_ptr); }
78
78
T* operator->() const { return m_ptr; }
80
80
operator bool() const { return m_ptr; }
90
class ProtectedJSValuePtr {
90
class ProtectedJSValue {
92
ProtectedJSValuePtr() {}
93
ProtectedJSValuePtr(JSValuePtr value);
94
ProtectedJSValuePtr(const ProtectedJSValuePtr&);
95
~ProtectedJSValuePtr();
93
ProtectedJSValue(JSValue value);
94
ProtectedJSValue(const ProtectedJSValue&);
97
template <class U> ProtectedJSValuePtr(const ProtectedPtr<U>&);
97
template <class U> ProtectedJSValue(const ProtectedPtr<U>&);
99
JSValuePtr get() const { return m_value; }
100
operator JSValuePtr() const { return m_value; }
101
JSValuePtr operator->() const { return m_value; }
99
JSValue get() const { return m_value; }
100
operator JSValue() const { return m_value; }
101
JSValue operator->() const { return m_value; }
103
103
operator bool() const { return m_value; }
104
104
bool operator!() const { return !m_value; }
106
ProtectedJSValuePtr& operator=(const ProtectedJSValuePtr&);
107
ProtectedJSValuePtr& operator=(JSValuePtr);
106
ProtectedJSValue& operator=(const ProtectedJSValue&);
107
ProtectedJSValue& operator=(JSValue);
113
113
template <class T> inline ProtectedPtr<T>::ProtectedPtr(T* ptr)
153
inline ProtectedJSValuePtr::ProtectedJSValuePtr(JSValuePtr value)
153
inline ProtectedJSValue::ProtectedJSValue(JSValue value)
156
156
gcProtect(m_value);
159
inline ProtectedJSValuePtr::ProtectedJSValuePtr(const ProtectedJSValuePtr& o)
159
inline ProtectedJSValue::ProtectedJSValue(const ProtectedJSValue& o)
160
160
: m_value(o.get())
162
162
gcProtect(m_value);
165
inline ProtectedJSValuePtr::~ProtectedJSValuePtr()
165
inline ProtectedJSValue::~ProtectedJSValue()
167
167
gcUnprotect(m_value);
170
template <class U> ProtectedJSValuePtr::ProtectedJSValuePtr(const ProtectedPtr<U>& o)
170
template <class U> ProtectedJSValue::ProtectedJSValue(const ProtectedPtr<U>& o)
171
171
: m_value(o.get())
173
173
gcProtect(m_value);
176
inline ProtectedJSValuePtr& ProtectedJSValuePtr::operator=(const ProtectedJSValuePtr& o)
176
inline ProtectedJSValue& ProtectedJSValue::operator=(const ProtectedJSValue& o)
178
JSValuePtr ovalue = o.m_value;
178
JSValue ovalue = o.m_value;
179
179
gcProtect(ovalue);
180
180
gcUnprotect(m_value);
181
181
m_value = ovalue;
185
inline ProtectedJSValuePtr& ProtectedJSValuePtr::operator=(JSValuePtr ovalue)
185
inline ProtectedJSValue& ProtectedJSValue::operator=(JSValue ovalue)
187
187
gcProtect(ovalue);
188
188
gcUnprotect(m_value);
198
198
template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const T* b) { return a.get() != b; }
199
199
template <class T> inline bool operator!=(const T* a, const ProtectedPtr<T>& b) { return a != b.get(); }
201
inline bool operator==(const ProtectedJSValuePtr& a, const ProtectedJSValuePtr& b) { return a.get() == b.get(); }
202
inline bool operator==(const ProtectedJSValuePtr& a, const JSValuePtr b) { return a.get() == b; }
203
template <class T> inline bool operator==(const ProtectedJSValuePtr& a, const ProtectedPtr<T>& b) { return a.get() == JSValuePtr(b.get()); }
204
inline bool operator==(const JSValuePtr a, const ProtectedJSValuePtr& b) { return a == b.get(); }
205
template <class T> inline bool operator==(const ProtectedPtr<T>& a, const ProtectedJSValuePtr& b) { return JSValuePtr(a.get()) == b.get(); }
201
inline bool operator==(const ProtectedJSValue& a, const ProtectedJSValue& b) { return a.get() == b.get(); }
202
inline bool operator==(const ProtectedJSValue& a, const JSValue b) { return a.get() == b; }
203
template <class T> inline bool operator==(const ProtectedJSValue& a, const ProtectedPtr<T>& b) { return a.get() == JSValue(b.get()); }
204
inline bool operator==(const JSValue a, const ProtectedJSValue& b) { return a == b.get(); }
205
template <class T> inline bool operator==(const ProtectedPtr<T>& a, const ProtectedJSValue& b) { return JSValue(a.get()) == b.get(); }
207
inline bool operator!=(const ProtectedJSValuePtr& a, const ProtectedJSValuePtr& b) { return a.get() != b.get(); }
208
inline bool operator!=(const ProtectedJSValuePtr& a, const JSValuePtr b) { return a.get() != b; }
209
template <class T> inline bool operator!=(const ProtectedJSValuePtr& a, const ProtectedPtr<T>& b) { return a.get() != JSValuePtr(b.get()); }
210
inline bool operator!=(const JSValuePtr a, const ProtectedJSValuePtr& b) { return a != b.get(); }
211
template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const ProtectedJSValuePtr& b) { return JSValuePtr(a.get()) != b.get(); }
207
inline bool operator!=(const ProtectedJSValue& a, const ProtectedJSValue& b) { return a.get() != b.get(); }
208
inline bool operator!=(const ProtectedJSValue& a, const JSValue b) { return a.get() != b; }
209
template <class T> inline bool operator!=(const ProtectedJSValue& a, const ProtectedPtr<T>& b) { return a.get() != JSValue(b.get()); }
210
inline bool operator!=(const JSValue a, const ProtectedJSValue& b) { return a != b.get(); }
211
template <class T> inline bool operator!=(const ProtectedPtr<T>& a, const ProtectedJSValue& b) { return JSValue(a.get()) != b.get(); }
213
213
} // namespace JSC