Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtr.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21 #ifndef WTF_RefPtr_h
22 #define WTF_RefPtr_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtr.h:22:9`!
23
24 #include <algorithm>
25 #include "AlwaysInline.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h`/
26 #include "FastAllocBase.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h`/
27 #if COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(WINSCW)
28 #include "PassRefPtr.h"
29 #endif
30
31 namespace WTFcxx . . $ QTWTF/ {
32
33 enum PlacementNewAdoptTypecxx . . $ QTWTF/PlacementNewAdoptType# { PlacementNewAdoptcxx . . $ QTWTF/PlacementNewAdopt. };
34
35 template <typename T> class PassRefPtrcxx . . $ QTWTF/PassRefPtr#;
36 template <typename T> class NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#;
37
38 enum HashTableDeletedValueTypecxx . . $ QTWTF/HashTableDeletedValueType# { HashTableDeletedValuecxx . . $ QTWTF/HashTableDeletedValue. };
39
40 template <typename T> class RefPtrcxx . . $ QTWTF/RefPtr# : public FastAllocBasecxx . . $ QTWTF/FastAllocBase# {
41 public:
42 RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(49f6e7a06ebc5aa8).() : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(0) { }
43 RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(ebd0a1552f8ce24f).(T* ptr) : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(ptr) { if (ptr) ptr->ref(); }
44 RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(66ad96f5df2a024b).(const RefPtr& o) : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(o.m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.) { if (T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.) ptr->ref(); }
45 // see comment in PassRefPtr.h for why this takes const reference
46 template <typename U> RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(71361d7f1043064a).(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<U>&);
47 template <typename U> RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(71ac27562e9f34e5).(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<U>&);
48
49 // Special constructor for cases where we overwrite an object in place.
50 RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(cc0015d274ebce84).(PlacementNewAdoptTypecxx . . $ QTWTF/PlacementNewAdoptType#) { }
51
52 // Hash table deleted values, which are only constructed and never copied or destroyed.
53 RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(b0f7ad2617ea7b68).(HashTableDeletedValueTypecxx . . $ QTWTF/HashTableDeletedValueType#) : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(hashTableDeletedValuecxx . . $ QTWTF/RefPtr#hashTableDeletedValue(155dc7f103cdb9db).()) { }
54 bool isHashTableDeletedValuecxx . . $ QTWTF/RefPtr#isHashTableDeletedValue(50ce9a9e25b4a850).() const { return m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. ==cxx . . $ `operator==`(174a78556a962c92). hashTableDeletedValuecxx . . $ QTWTF/RefPtr#hashTableDeletedValue(155dc7f103cdb9db).(); }
55
56 #if COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(WINSCW)
57 ~RefPtr() { if (T* ptr = m_ptr) derefIfNotNull<T>(ptr); }
58 #else
59 ~cxx . . $ QTWTF/RefPtr#`~RefPtr<T>`(49f6e7a06ebc5aa8).RefPtr() { if (T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.) ptr->deref(); }
60 #endif
61
62 template <typename U> RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(11a1ac667024f826).(const RefPtrcxx . . $ QTWTF/RefPtr#<U>& o) : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(o.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).()) { if (T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.) ptr->ref(); }
63
64 T* getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).() const { return m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.; }
65
66 #if COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(WINSCW)
67 void clear() { if (T* ptr = m_ptr) derefIfNotNull<T>(ptr); m_ptr = 0; }
68 #else
69 void clearcxx . . $ QTWTF/RefPtr#clear(49f6e7a06ebc5aa8).() { if (T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.) ptr->deref(); m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = 0; }
70 #endif
71 PassRefPtrcxx . . $ QTWTF/PassRefPtr#<T> releasecxx . . $ QTWTF/RefPtr#release(fefcb7d0da452c2c).() { PassRefPtrcxx . . $ QTWTF/PassRefPtr#<T> tmp = adoptRefcxx . . $ QTWTF/adoptRef(e761da608bb8c29c).(m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.); m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = 0; return tmp; }
72
73 T& operatorcxx . . $ QTWTF/RefPtr#`operator*`(c93303b41ac66b6d).*() const { return *m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.; }
74 ALWAYS_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! T* operatorcxx . . $ QTWTF/RefPtr#`operator->`(5a2a78a048fb49a8).->() const { return m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.; }
75
76 bool operatorcxx . . $ QTWTF/RefPtr#`operator!`(50ce9a9e25b4a850).!() const { return !m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.; }
77
78 // This conversion operator allows implicit conversion to bool but not to other integer types.
79 typedef T* (RefPtrcxx . . $ QTWTF/RefPtr#::*UnspecifiedBoolTypecxx . . $ QTWTF/RefPtr#UnspecifiedBoolType#);
80 operatorcxx . . $ QTWTF/RefPtr#`operator type-parameter-0-0 *RefPtr<T>::*`(9ba8a86d8e56037). UnspecifiedBoolTypecxx . . $ QTWTF/RefPtr#UnspecifiedBoolType#() const { return m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. ? &RefPtrcxx . . $ QTWTF/RefPtr#::m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. : 0; }
81
82 RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(c3448acae4499e2d).=(const RefPtr&);
83 RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(5d50dd9a654839a9).=(T*);
84 RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(cdd7799538ed6d81).=(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<T>&);
85 RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(581a24c15f50ac26).=(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<T>&);
86 template <typename U> RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(59fcb0c1db200088).=(const RefPtrcxx . . $ QTWTF/RefPtr#<U>&);
87 template <typename U> RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(f5b0024fb851815e).=(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<U>&);
88 template <typename U> RefPtr& operatorcxx . . $ QTWTF/RefPtr#`operator=`(fbd36ba8a3358e61).=(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<U>&);
89
90 void swapcxx . . $ QTWTF/RefPtr#swap(8a3b52ba6b5b7511).(RefPtr&);
91
92 private:
93 static T* hashTableDeletedValuecxx . . $ QTWTF/RefPtr#hashTableDeletedValue(155dc7f103cdb9db).() { return reinterpret_cast<T*>(-1); }
94
95 T* m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
96 };
97
98 template <typename T> template <typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>::RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(71361d7f1043064a).(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<U>& o)
99 : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(o.releaseRefcxx . . $ QTWTF/PassRefPtr#releaseRef(5a2a78a048fb49a8).())
100 {
101 }
102
103 template <typename T> template <typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>::RefPtrcxx . . $ QTWTF/RefPtr#`RefPtr<T>`(71ac27562e9f34e5).(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<U>& o)
104 : m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.(o.releaseRefcxx . . $ QTWTF/NonNullPassRefPtr#releaseRef(5a2a78a048fb49a8).())
105 {
106 }
107
108 template <typename T> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(c3448acae4499e2d).=(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& o)
109 {
110 T* optr = o.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
111 if (optr)
112 optr->ref();
113 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
114 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = optr;
115 if (ptr)
116 ptr->deref();
117 return *this;
118 }
119
120 template <typename T> template <typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(59fcb0c1db200088).=(const RefPtrcxx . . $ QTWTF/RefPtr#<U>& o)
121 {
122 T* optr = o.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
123 if (optr)
124 optr->ref();
125 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
126 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = optr;
127 if (ptr)
128 ptr->deref();
129 return *this;
130 }
131
132 template <typename T> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(5d50dd9a654839a9).=(T* optr)
133 {
134 if (optr)
135 optr->ref();
136 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
137 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = optr;
138 if (ptr)
139 ptr->deref();
140 return *this;
141 }
142
143 template <typename T> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(cdd7799538ed6d81).=(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<T>& o)
144 {
145 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
146 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = o.releaseRefcxx . . $ QTWTF/PassRefPtr#releaseRef(5a2a78a048fb49a8).();
147 if (ptr)
148 ptr->deref();
149 return *this;
150 }
151
152 template <typename T> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(581a24c15f50ac26).=(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<T>& o)
153 {
154 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
155 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = o.releaseRefcxx . . $ QTWTF/NonNullPassRefPtr#releaseRef(5a2a78a048fb49a8).();
156 if (ptr)
157 ptr->deref();
158 return *this;
159 }
160
161 template <typename T> template <typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(f5b0024fb851815e).=(const PassRefPtrcxx . . $ QTWTF/PassRefPtr#<U>& o)
162 {
163 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
164 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = o.releaseRefcxx . . $ QTWTF/PassRefPtr#releaseRef(5a2a78a048fb49a8).();
165 if (ptr)
166 ptr->deref();
167 return *this;
168 }
169
170 template <typename T> template <typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T>& RefPtrcxx . . $ QTWTF/RefPtr#<T>::operatorcxx . . $ QTWTF/RefPtr#`operator=`(fbd36ba8a3358e61).=(const NonNullPassRefPtrcxx . . $ QTWTF/NonNullPassRefPtr#<U>& o)
171 {
172 T* ptr = m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.;
173 m_ptrcxx . . $ QTWTF/RefPtr#m_ptr. = o.releaseRefcxx . . $ QTWTF/NonNullPassRefPtr#releaseRef(5a2a78a048fb49a8).();
174 if (ptr)
175 ptr->deref();
176 return *this;
177 }
178
179 template <class T> inline void RefPtrcxx . . $ QTWTF/RefPtr#<T>::swapcxx . . $ QTWTF/RefPtr#swap(8a3b52ba6b5b7511).(RefPtrcxx . . $ QTWTF/RefPtr#<T>& o)
180 {
181 stdcxx . . $ std/::swapcxx . . $ std/swap(a82ae8f1d52ef9ba).(m_ptrcxx . . $ QTWTF/RefPtr#m_ptr., o.m_ptrcxx . . $ QTWTF/RefPtr#m_ptr.);
182 }
183
184 template <class T> inline void swapcxx . . $ QTWTF/swap(df983f423f491431).(RefPtrcxx . . $ QTWTF/RefPtr#<T>& a, RefPtrcxx . . $ QTWTF/RefPtr#<T>& b)
185 {
186 a.swapcxx . . $ QTWTF/RefPtr#swap(8a3b52ba6b5b7511).(b);
187 }
188
189 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator==`(69feba05d53a7241).==(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& a, const RefPtrcxx . . $ QTWTF/RefPtr#<U>& b)
190 {
191 return a.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).() ==cxx . . $ QTWTF/`operator==`(31369b2754de4004). b.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
192 }
193
194 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator==`(74c38ce5a82188a5).==(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& a, U* b)
195 {
196 return a.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).() ==cxx . . $ QTWTF/`operator==`(69feba05d53a7241). b;
197 }
198
199 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator==`(80d3fa33a1df3c2c).==(T* a, const RefPtrcxx . . $ QTWTF/RefPtr#<U>& b)
200 {
201 return a ==cxx . . $ QTWTF/`operator==`(4bad3d8cb7496246). b.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
202 }
203
204 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator!=`(69feba05d53a7241).!=(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& a, const RefPtrcxx . . $ QTWTF/RefPtr#<U>& b)
205 {
206 return a.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).() !=cxx . . $ QTWTF/`operator!=`(b1a6445b02f80637). b.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
207 }
208
209 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator!=`(74c38ce5a82188a5).!=(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& a, U* b)
210 {
211 return a.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).() !=cxx . . $ QTWTF/`operator!=`(4bad3d8cb7496246). b;
212 }
213
214 template <typename T, typename U> inline bool operatorcxx . . $ QTWTF/`operator!=`(80d3fa33a1df3c2c).!=(T* a, const RefPtrcxx . . $ QTWTF/RefPtr#<U>& b)
215 {
216 return a !=cxx . . $ QTWTF/`operator!=`(f838b2bc7e5b4b06). b.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
217 }
218
219 template <typename T, typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T> static_pointer_castcxx . . $ QTWTF/static_pointer_cast(1e26d8c895f828ae).(const RefPtrcxx . . $ QTWTF/RefPtr#<U>& p)
220 {
221 return RefPtrcxx . . $ QTWTF/RefPtr#<T>(static_cast<T*>(p.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).()));
222 }
223
224 template <typename T, typename U> inline RefPtrcxx . . $ QTWTF/RefPtr#<T> const_pointer_castcxx . . $ QTWTF/const_pointer_cast(1e26d8c895f828ae).(const RefPtrcxx . . $ QTWTF/RefPtr#<U>& p)
225 {
226 return RefPtrcxx . . $ QTWTF/RefPtr#<T>(const_cast<T*>(p.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).()));
227 }
228
229 template <typename T> inline T* getPtrcxx . . $ QTWTF/getPtr(23f3fc4dfb2d9130).(const RefPtrcxx . . $ QTWTF/RefPtr#<T>& p)
230 {
231 return p.getcxx . . $ QTWTF/RefPtr#get(5a2a78a048fb49a8).();
232 }
233
234 } // namespace WTF
235
236 using WTFcxx . . $ QTWTF/::RefPtrcxx . . $ RefPtr#;
237 using WTFcxx . . $ QTWTF/::static_pointer_castcxx . . $ static_pointer_cast(1e26d8c895f828ae).;
238 using WTFcxx . . $ `<built-in>:467:9`!::const_pointer_castcxx . . $ QTWTF/const_pointer_cast(1e26d8c895f828ae).;
239
240 #endif // WTF_RefPtr_h