Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: Source/wtf/RefPtr.h

Issue 267303004: Oilpan: cleanup based on review comments after removal of TreeShared. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« Source/core/svg/SVGElement.cpp ('K') | « Source/wtf/PassRefPtr.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b) 156 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
157 { 157 {
158 return a.get() == b; 158 return a.get() == b;
159 } 159 }
160 160
161 template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U >& b) 161 template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U >& b)
162 { 162 {
163 return a == b.get(); 163 return a == b.get();
164 } 164 }
165 165
166 template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const U& b)
Mikhail 2014/05/07 12:34:28 I would not like us to implicitly compare RefPtr w
Mads Ager (chromium) 2014/05/07 12:40:09 It will not (compile-time error because of ambigui
tkent 2014/05/07 14:11:05 I also have a concern about adding the generic ver
167 {
168 return a.get() == &b;
169 }
170
171 template<typename T, typename U> inline bool operator==(const T& a, const Re fPtr<U>& b)
172 {
173 return &a == b.get();
174 }
175
166 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b) 176 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
167 { 177 {
168 return a.get() != b.get(); 178 return a.get() != b.get();
169 } 179 }
170 180
171 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b) 181 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
172 { 182 {
173 return a.get() != b; 183 return a.get() != b;
174 } 184 }
175 185
176 template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U >& b) 186 template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U >& b)
177 { 187 {
178 return a != b.get(); 188 return a != b.get();
179 } 189 }
180 190
191 template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const U& b)
192 {
193 return a.get() != &b;
194 }
195
196 template<typename T, typename U> inline bool operator!=(const T& a, const Re fPtr<U>& b)
197 {
198 return &a != b.get();
199 }
200
181 template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p) 201 template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
182 { 202 {
183 return RefPtr<T>(static_cast<T*>(p.get())); 203 return RefPtr<T>(static_cast<T*>(p.get()));
184 } 204 }
185 205
186 template<typename T> inline T* getPtr(const RefPtr<T>& p) 206 template<typename T> inline T* getPtr(const RefPtr<T>& p)
187 { 207 {
188 return p.get(); 208 return p.get();
189 } 209 }
190 210
191 template<typename T> class RefPtrValuePeeker { 211 template<typename T> class RefPtrValuePeeker {
192 public: 212 public:
193 ALWAYS_INLINE RefPtrValuePeeker(T* p): m_ptr(p) { } 213 ALWAYS_INLINE RefPtrValuePeeker(T* p): m_ptr(p) { }
194 ALWAYS_INLINE RefPtrValuePeeker(std::nullptr_t): m_ptr(0) { } 214 ALWAYS_INLINE RefPtrValuePeeker(std::nullptr_t): m_ptr(0) { }
195 template<typename U> RefPtrValuePeeker(const RefPtr<U>& p): m_ptr(p.get( )) { } 215 template<typename U> RefPtrValuePeeker(const RefPtr<U>& p): m_ptr(p.get( )) { }
196 template<typename U> RefPtrValuePeeker(const PassRefPtr<U>& p): m_ptr(p. get()) { } 216 template<typename U> RefPtrValuePeeker(const PassRefPtr<U>& p): m_ptr(p. get()) { }
197 217
198 ALWAYS_INLINE operator T*() const { return m_ptr; } 218 ALWAYS_INLINE operator T*() const { return m_ptr; }
199 private: 219 private:
200 T* m_ptr; 220 T* m_ptr;
201 }; 221 };
202 222
203 } // namespace WTF 223 } // namespace WTF
204 224
205 using WTF::RefPtr; 225 using WTF::RefPtr;
206 using WTF::static_pointer_cast; 226 using WTF::static_pointer_cast;
207 227
208 #endif // WTF_RefPtr_h 228 #endif // WTF_RefPtr_h
OLDNEW
« Source/core/svg/SVGElement.cpp ('K') | « Source/wtf/PassRefPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698