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

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

Issue 2145643002: Purge UnspecifiedBoolType from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/RetainPtr.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) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(get()); 100 DCHECK(get());
101 return *get(); 101 return *get();
102 } 102 }
103 103
104 T* operator->() const 104 T* operator->() const
105 { 105 {
106 DCHECK(get()); 106 DCHECK(get());
107 return get(); 107 return get();
108 } 108 }
109 109
110 typedef RefPtr<WeakReference<T>> (WeakPtr::*UnspecifiedBoolType); 110 explicit operator bool() const { return get(); }
111 operator UnspecifiedBoolType() const { return get() ? &WeakPtr::m_ref : 0; }
112 111
113 private: 112 private:
114 RefPtr<WeakReference<T>> m_ref; 113 RefPtr<WeakReference<T>> m_ref;
115 }; 114 };
116 115
117 template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, con st WeakPtr<U>& b) 116 template<typename T, typename U> inline bool operator==(const WeakPtr<T>& a, con st WeakPtr<U>& b)
118 { 117 {
119 return a.get() == b.get(); 118 return a.get() == b.get();
120 } 119 }
121 120
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 RefPtr<WeakReference<T>> m_ref; 158 RefPtr<WeakReference<T>> m_ref;
160 }; 159 };
161 160
162 } // namespace WTF 161 } // namespace WTF
163 162
164 using WTF::WeakPtr; 163 using WTF::WeakPtr;
165 using WTF::WeakPtrFactory; 164 using WTF::WeakPtrFactory;
166 using WTF::WeakReference; 165 using WTF::WeakReference;
167 166
168 #endif 167 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/RetainPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698