~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to JavaScriptCore/runtime/Protect.h

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
            gcUnprotect(val);
50
50
    }
51
51
    
52
 
    inline void gcProtect(JSValuePtr value)
 
52
    inline void gcProtect(JSValue value)
53
53
    {
54
54
        if (value && value.isCell())
55
55
            gcProtect(asCell(value));
56
56
    }
57
57
 
58
 
    inline void gcUnprotect(JSValuePtr value)
 
58
    inline void gcUnprotect(JSValue value)
59
59
    {
60
60
        if (value && value.isCell())
61
61
            gcUnprotect(asCell(value));
74
74
        
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; }
79
79
        
80
80
        operator bool() const { return m_ptr; }
87
87
        T* m_ptr;
88
88
    };
89
89
 
90
 
    class ProtectedJSValuePtr {
 
90
    class ProtectedJSValue {
91
91
    public:
92
 
        ProtectedJSValuePtr() {}
93
 
        ProtectedJSValuePtr(JSValuePtr value);
94
 
        ProtectedJSValuePtr(const ProtectedJSValuePtr&);
95
 
        ~ProtectedJSValuePtr();
 
92
        ProtectedJSValue() {}
 
93
        ProtectedJSValue(JSValue value);
 
94
        ProtectedJSValue(const ProtectedJSValue&);
 
95
        ~ProtectedJSValue();
96
96
 
97
 
        template <class U> ProtectedJSValuePtr(const ProtectedPtr<U>&);
 
97
        template <class U> ProtectedJSValue(const ProtectedPtr<U>&);
98
98
        
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; }
102
102
        
103
103
        operator bool() const { return m_value; }
104
104
        bool operator!() const { return !m_value; }
105
105
 
106
 
        ProtectedJSValuePtr& operator=(const ProtectedJSValuePtr&);
107
 
        ProtectedJSValuePtr& operator=(JSValuePtr);
 
106
        ProtectedJSValue& operator=(const ProtectedJSValue&);
 
107
        ProtectedJSValue& operator=(JSValue);
108
108
        
109
109
    private:
110
 
        JSValuePtr m_value;
 
110
        JSValue m_value;
111
111
    };
112
112
 
113
113
    template <class T> inline ProtectedPtr<T>::ProtectedPtr(T* ptr)
150
150
        return *this;
151
151
    }
152
152
 
153
 
    inline ProtectedJSValuePtr::ProtectedJSValuePtr(JSValuePtr value)
 
153
    inline ProtectedJSValue::ProtectedJSValue(JSValue value)
154
154
        : m_value(value)
155
155
    {
156
156
        gcProtect(m_value);
157
157
    }
158
158
 
159
 
    inline ProtectedJSValuePtr::ProtectedJSValuePtr(const ProtectedJSValuePtr& o)
 
159
    inline ProtectedJSValue::ProtectedJSValue(const ProtectedJSValue& o)
160
160
        : m_value(o.get())
161
161
    {
162
162
        gcProtect(m_value);
163
163
    }
164
164
 
165
 
    inline ProtectedJSValuePtr::~ProtectedJSValuePtr()
 
165
    inline ProtectedJSValue::~ProtectedJSValue()
166
166
    {
167
167
        gcUnprotect(m_value);
168
168
    }
169
169
 
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())
172
172
    {
173
173
        gcProtect(m_value);
174
174
    }
175
175
 
176
 
    inline ProtectedJSValuePtr& ProtectedJSValuePtr::operator=(const ProtectedJSValuePtr& o) 
 
176
    inline ProtectedJSValue& ProtectedJSValue::operator=(const ProtectedJSValue& o) 
177
177
    {
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;
182
182
        return *this;
183
183
    }
184
184
 
185
 
    inline ProtectedJSValuePtr& ProtectedJSValuePtr::operator=(JSValuePtr ovalue)
 
185
    inline ProtectedJSValue& ProtectedJSValue::operator=(JSValue ovalue)
186
186
    {
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(); }
200
200
 
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(); }
206
206
 
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(); }
212
212
 
213
213
} // namespace JSC
214
214