Changeset 103008 in webkit
- Timestamp:
- Dec 15, 2011 6:00:43 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r103003 r103008 1 2011-12-15 Anders Carlsson <andersca@apple.com> 2 3 Regression (r102866): Navigating away from or closing a page with a plugin crashes 4 https://bugs.webkit.org/show_bug.cgi?id=74655 5 <rdar://problem/10590024> 6 7 Reviewed by Sam Weinig. 8 9 Rewrite HasRefAndDeref to work if ref and deref are implemented in base classes, 10 using a modified version of the technique described here: 11 http://groups.google.com/group/comp.lang.c++.moderated/msg/e5fbc9305539f699 12 13 * wtf/Functional.h: 14 1 15 2011-12-15 Andy Wingo <wingo@igalia.com> 2 16 -
trunk/Source/JavaScriptCore/wtf/Functional.h
r102963 r103008 47 47 }; 48 48 49 template<typename U, U, U> struct TypeChecker { }; 49 struct BaseMixin { 50 void deref(); 51 void ref(); 52 }; 53 54 struct Base : public T, public BaseMixin { }; 55 56 template<typename U, U> struct 57 TypeChecker { }; 50 58 51 59 template<typename U> 52 static YesType refAndDerefCheck(TypeChecker<void (U::*)(), &U::ref, &U::deref>*); 60 static NoType refCheck(U*, TypeChecker<void (BaseMixin::*)(), &U::ref>* = 0); 61 static YesType refCheck(...); 53 62 54 63 template<typename U> 55 static NoType refAndDerefCheck(...); 56 57 public: 58 static const bool value = sizeof(refAndDerefCheck<T>(0)) == sizeof(YesType); 64 static NoType derefCheck(U*, TypeChecker<void (BaseMixin::*)(), &U::deref>* = 0); 65 static YesType derefCheck(...); 66 67 public: 68 static const bool value = sizeof(refCheck(static_cast<Base*>(0))) == sizeof(YesType) && sizeof(derefCheck(static_cast<Base*>(0))) == sizeof(YesType); 59 69 }; 60 70 -
trunk/Tools/ChangeLog
r103002 r103008 1 2011-12-15 Anders Carlsson <andersca@apple.com> 2 3 Regression (r102866): Navigating away from or closing a page with a plugin crashes 4 https://bugs.webkit.org/show_bug.cgi?id=74655 5 6 Reviewed by Sam Weinig. 7 8 Add a bunch of tests. 9 10 * TestWebKitAPI/Tests/WTF/Functional.cpp: 11 1 12 2011-12-15 Stephanie Lewis <slewis@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WTF/Functional.cpp
r102860 r103008 152 152 } 153 153 154 namespace RefAndDerefTests { 155 156 template<typename T> struct RefCounted { 157 void ref(); 158 void deref(); 159 }; 160 struct Connection : RefCounted<Connection> { }; 161 COMPILE_ASSERT(WTF::HasRefAndDeref<Connection>::value, class_has_ref_and_deref); 162 163 struct NoRefOrDeref { }; 164 COMPILE_ASSERT(!WTF::HasRefAndDeref<NoRefOrDeref>::value, class_has_no_ref_or_deref); 165 166 struct RefOnly { void ref(); }; 167 COMPILE_ASSERT(!WTF::HasRefAndDeref<RefOnly>::value, class_has_ref_only); 168 169 struct DerefOnly { void deref(); }; 170 COMPILE_ASSERT(!WTF::HasRefAndDeref<DerefOnly>::value, class_has_deref_only); 171 172 } 173 154 174 } // namespace TestWebKitAPI
Note: See TracChangeset
for help on using the changeset viewer.