Chromium Code Reviews| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 inline bool operator!=(const thisType& a, const thisType* b) { return !(a == b); } \ | 373 inline bool operator!=(const thisType& a, const thisType* b) { return !(a == b); } \ |
| 374 inline bool operator!=(const thisType* a, const thisType& b) { return !(a == b); } | 374 inline bool operator!=(const thisType* a, const thisType& b) { return !(a == b); } |
| 375 | 375 |
| 376 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_REFCOUNTED(thisType) \ | 376 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_REFCOUNTED(thisType) \ |
| 377 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ | 377 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ |
| 378 inline bool operator==(const PassRefPtr<thisType>& a, const thisType& b) { r eturn a.get() == &b; } \ | 378 inline bool operator==(const PassRefPtr<thisType>& a, const thisType& b) { r eturn a.get() == &b; } \ |
| 379 inline bool operator==(const thisType& a, const PassRefPtr<thisType>& b) { r eturn &a == b.get(); } \ | 379 inline bool operator==(const thisType& a, const PassRefPtr<thisType>& b) { r eturn &a == b.get(); } \ |
| 380 inline bool operator!=(const PassRefPtr<thisType>& a, const thisType& b) { r eturn !(a == b); } \ | 380 inline bool operator!=(const PassRefPtr<thisType>& a, const thisType& b) { r eturn !(a == b); } \ |
| 381 inline bool operator!=(const thisType& a, const PassRefPtr<thisType>& b) { r eturn !(a == b); } | 381 inline bool operator!=(const thisType& a, const PassRefPtr<thisType>& b) { r eturn !(a == b); } |
| 382 | 382 |
| 383 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES_RAWPTR(thisType) \ | |
| 384 inline bool operator==(const RawPtr<thisType>& a, const thisType& b) { retur n a.get() == &b; } \ | |
|
Mads Ager (chromium)
2014/06/04 09:27:26
This is in line with what is being done now, so ju
Erik Corry
2014/06/04 09:35:47
I agree that the need for this indicates we are us
tkent
2014/06/05 00:22:27
As you know, it's off-topic. I don't think we hav
| |
| 385 inline bool operator==(const thisType& a, const RawPtr<thisType>& b) { retur n &a == b.get(); } \ | |
| 386 inline bool operator!=(const RawPtr<thisType>& a, const thisType& b) { retur n !(a == b); } \ | |
| 387 inline bool operator!=(const thisType& a, const RawPtr<thisType>& b) { retur n !(a == b); } | |
| 388 | |
| 383 /* DEFINE_TYPE_CASTS */ | 389 /* DEFINE_TYPE_CASTS */ |
| 384 | 390 |
| 385 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate , referencePredicate) \ | 391 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, pointerPredicate , referencePredicate) \ |
| 386 inline thisType* to##thisType(argumentType* argumentName) \ | 392 inline thisType* to##thisType(argumentType* argumentName) \ |
| 387 { \ | 393 { \ |
| 388 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 394 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 389 return static_cast<thisType*>(argumentName); \ | 395 return static_cast<thisType*>(argumentName); \ |
| 390 } \ | 396 } \ |
| 391 inline const thisType* to##thisType(const argumentType* argumentName) \ | 397 inline const thisType* to##thisType(const argumentType* argumentName) \ |
| 392 { \ | 398 { \ |
| 393 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ | 399 ASSERT_WITH_SECURITY_IMPLICATION(!argumentName || (pointerPredicate)); \ |
| 394 return static_cast<const thisType*>(argumentName); \ | 400 return static_cast<const thisType*>(argumentName); \ |
| 395 } \ | 401 } \ |
| 396 inline thisType& to##thisType(argumentType& argumentName) \ | 402 inline thisType& to##thisType(argumentType& argumentName) \ |
| 397 { \ | 403 { \ |
| 398 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 404 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 399 return static_cast<thisType&>(argumentName); \ | 405 return static_cast<thisType&>(argumentName); \ |
| 400 } \ | 406 } \ |
| 401 inline const thisType& to##thisType(const argumentType& argumentName) \ | 407 inline const thisType& to##thisType(const argumentType& argumentName) \ |
| 402 { \ | 408 { \ |
| 403 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ | 409 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ |
| 404 return static_cast<const thisType&>(argumentName); \ | 410 return static_cast<const thisType&>(argumentName); \ |
| 405 } \ | 411 } \ |
| 406 void to##thisType(const thisType*); \ | 412 void to##thisType(const thisType*); \ |
| 407 void to##thisType(const thisType&) | 413 void to##thisType(const thisType&) |
| 408 | 414 |
| 409 #endif /* WTF_Assertions_h */ | 415 #endif /* WTF_Assertions_h */ |
| OLD | NEW |