| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 WTFAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, sizeof(*(pointer)), \ | 61 WTFAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, sizeof(*(pointer)), \ |
| 62 description) | 62 description) |
| 63 | 63 |
| 64 /* Annotations for user-defined synchronization mechanisms. | 64 /* Annotations for user-defined synchronization mechanisms. |
| 65 * These annotations can be used to define happens-before arcs in user-defined | 65 * These annotations can be used to define happens-before arcs in user-defined |
| 66 * synchronization mechanisms: the race detector will infer an arc from | 66 * synchronization mechanisms: the race detector will infer an arc from |
| 67 * the former to the latter when they share the same argument pointer. | 67 * the former to the latter when they share the same argument pointer. |
| 68 * | 68 * |
| 69 * The most common case requiring annotations is atomic reference counting: | 69 * The most common case requiring annotations is atomic reference counting: |
| 70 * bool deref() { | 70 * bool deref() { |
| 71 * ANNOTATE_HAPPENS_BEFORE(&m_refCount); | 71 * ANNOTATE_HAPPENS_BEFORE(&ref_count_); |
| 72 * if (!atomicDecrement(&m_refCount)) { | 72 * if (!atomicDecrement(&ref_count_)) { |
| 73 * // m_refCount is now 0 | 73 * // ref_count_ is now 0 |
| 74 * ANNOTATE_HAPPENS_AFTER(&m_refCount); | 74 * ANNOTATE_HAPPENS_AFTER(&ref_count_); |
| 75 * // "return true; happens-after each atomicDecrement of m_refCount" | 75 * // "return true; happens-after each atomicDecrement of ref_count_" |
| 76 * return true; | 76 * return true; |
| 77 * } | 77 * } |
| 78 * return false; | 78 * return false; |
| 79 * } | 79 * } |
| 80 */ | 80 */ |
| 81 #define WTF_ANNOTATE_HAPPENS_BEFORE(address) \ | 81 #define WTF_ANNOTATE_HAPPENS_BEFORE(address) \ |
| 82 WTFAnnotateHappensBefore(__FILE__, __LINE__, address) | 82 WTFAnnotateHappensBefore(__FILE__, __LINE__, address) |
| 83 #define WTF_ANNOTATE_HAPPENS_AFTER(address) \ | 83 #define WTF_ANNOTATE_HAPPENS_AFTER(address) \ |
| 84 WTFAnnotateHappensAfter(__FILE__, __LINE__, address) | 84 WTFAnnotateHappensAfter(__FILE__, __LINE__, address) |
| 85 | 85 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 105 #else // USE(DYNAMIC_ANNOTATIONS) | 105 #else // USE(DYNAMIC_ANNOTATIONS) |
| 106 /* These macros are empty when dynamic annotations are not enabled so you can | 106 /* These macros are empty when dynamic annotations are not enabled so you can |
| 107 * use them without affecting the performance of release binaries. */ | 107 * use them without affecting the performance of release binaries. */ |
| 108 #define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) | 108 #define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) |
| 109 #define WTF_ANNOTATE_BENIGN_RACE(pointer, description) | 109 #define WTF_ANNOTATE_BENIGN_RACE(pointer, description) |
| 110 #define WTF_ANNOTATE_HAPPENS_BEFORE(address) | 110 #define WTF_ANNOTATE_HAPPENS_BEFORE(address) |
| 111 #define WTF_ANNOTATE_HAPPENS_AFTER(address) | 111 #define WTF_ANNOTATE_HAPPENS_AFTER(address) |
| 112 #endif // USE(DYNAMIC_ANNOTATIONS) | 112 #endif // USE(DYNAMIC_ANNOTATIONS) |
| 113 | 113 |
| 114 #endif // WTF_DynamicAnnotations_h | 114 #endif // WTF_DynamicAnnotations_h |
| OLD | NEW |