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

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

Issue 2090973002: Reland: WTF: Simplify RefPtr::operator bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: != nullptr Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 PassRefPtr<T> tmp = adoptRef(m_ptr); 64 PassRefPtr<T> tmp = adoptRef(m_ptr);
65 m_ptr = nullptr; 65 m_ptr = nullptr;
66 return tmp; 66 return tmp;
67 } 67 }
68 68
69 T& operator*() const { return *m_ptr; } 69 T& operator*() const { return *m_ptr; }
70 ALWAYS_INLINE T* operator->() const { return m_ptr; } 70 ALWAYS_INLINE T* operator->() const { return m_ptr; }
71 71
72 bool operator!() const { return !m_ptr; } 72 bool operator!() const { return !m_ptr; }
73 73 explicit operator bool() const { return m_ptr != nullptr; }
74 // TODO(jbroman): Simplifying this in the obvious way causes a massive
75 // regression in a perf test on ARM. http://crbug.com/607208
76 explicit operator bool() const { return m_ptr ? &RefPtr::m_ptr : 0; }
77 74
78 RefPtr& operator=(RefPtr o) { swap(o); return *this; } 75 RefPtr& operator=(RefPtr o) { swap(o); return *this; }
79 RefPtr& operator=(std::nullptr_t) { clear(); return *this; } 76 RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
80 // This is required by HashMap<RefPtr>>. 77 // This is required by HashMap<RefPtr>>.
81 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>); 78 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>);
82 79
83 void swap(RefPtr&); 80 void swap(RefPtr&);
84 81
85 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } 82 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
86 83
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 private: 188 private:
192 T* m_ptr; 189 T* m_ptr;
193 }; 190 };
194 191
195 } // namespace WTF 192 } // namespace WTF
196 193
197 using WTF::RefPtr; 194 using WTF::RefPtr;
198 using WTF::static_pointer_cast; 195 using WTF::static_pointer_cast;
199 196
200 #endif // WTF_RefPtr_h 197 #endif // WTF_RefPtr_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/PassRefPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698