| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // Allow equality comparisons of Objects by reference or pointer, interchangeabl
y. | 284 // Allow equality comparisons of Objects by reference or pointer, interchangeabl
y. |
| 285 // This can be only used on types whose equality makes no other sense than point
er equality. | 285 // This can be only used on types whose equality makes no other sense than point
er equality. |
| 286 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ | 286 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ |
| 287 inline bool operator==(const thisType& a, const thisType& b) { return &a ==
&b; } \ | 287 inline bool operator==(const thisType& a, const thisType& b) { return &a ==
&b; } \ |
| 288 inline bool operator==(const thisType& a, const thisType* b) { return &a ==
b; } \ | 288 inline bool operator==(const thisType& a, const thisType* b) { return &a ==
b; } \ |
| 289 inline bool operator==(const thisType* a, const thisType& b) { return a == &
b; } \ | 289 inline bool operator==(const thisType* a, const thisType& b) { return a == &
b; } \ |
| 290 inline bool operator!=(const thisType& a, const thisType& b) { return !(a ==
b); } \ | 290 inline bool operator!=(const thisType& a, const thisType& b) { return !(a ==
b); } \ |
| 291 inline bool operator!=(const thisType& a, const thisType* b) { return !(a ==
b); } \ | 291 inline bool operator!=(const thisType& a, const thisType* b) { return !(a ==
b); } \ |
| 292 inline bool operator!=(const thisType* a, const thisType& b) { return !(a ==
b); } | 292 inline bool operator!=(const thisType* a, const thisType& b) { return !(a ==
b); } |
| 293 | 293 |
| 294 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_REFCOUNTED(thisType) \ | |
| 295 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ | |
| 296 inline bool operator==(const PassRefPtr<thisType>& a, const thisType& b) { r
eturn a.get() == &b; } \ | |
| 297 inline bool operator==(const thisType& a, const PassRefPtr<thisType>& b) { r
eturn &a == b.get(); } \ | |
| 298 inline bool operator!=(const PassRefPtr<thisType>& a, const thisType& b) { r
eturn !(a == b); } \ | |
| 299 inline bool operator!=(const thisType& a, const PassRefPtr<thisType>& b) { r
eturn !(a == b); } | |
| 300 | |
| 301 /* DEFINE_TYPE_CASTS */ | 294 /* DEFINE_TYPE_CASTS */ |
| 302 | 295 |
| 303 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate
, referencePredicate) \ | 296 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate
, referencePredicate) \ |
| 304 inline thisType* to##thisType(argumentType* argumentName) \ | 297 inline thisType* to##thisType(argumentType* argumentName) \ |
| 305 { \ | 298 { \ |
| 306 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 299 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 307 return static_cast<thisType*>(argumentName); \ | 300 return static_cast<thisType*>(argumentName); \ |
| 308 } \ | 301 } \ |
| 309 inline const thisType* to##thisType(const argumentType* argumentName) \ | 302 inline const thisType* to##thisType(const argumentType* argumentName) \ |
| 310 { \ | 303 { \ |
| 311 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 304 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 312 return static_cast<const thisType*>(argumentName); \ | 305 return static_cast<const thisType*>(argumentName); \ |
| 313 } \ | 306 } \ |
| 314 inline thisType& to##thisType(argumentType& argumentName) \ | 307 inline thisType& to##thisType(argumentType& argumentName) \ |
| 315 { \ | 308 { \ |
| 316 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 309 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 317 return static_cast<thisType&>(argumentName); \ | 310 return static_cast<thisType&>(argumentName); \ |
| 318 } \ | 311 } \ |
| 319 inline const thisType& to##thisType(const argumentType& argumentName) \ | 312 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 320 { \ | 313 { \ |
| 321 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 314 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 322 return static_cast<const thisType&>(argumentName); \ | 315 return static_cast<const thisType&>(argumentName); \ |
| 323 } \ | 316 } \ |
| 324 void to##thisType(const thisType*); \ | 317 void to##thisType(const thisType*); \ |
| 325 void to##thisType(const thisType&) | 318 void to##thisType(const thisType&) |
| 326 | 319 |
| 327 #endif /* WTF_Assertions_h */ | 320 #endif /* WTF_Assertions_h */ |
| OLD | NEW |