Return whether the reference count is one. If the reference count is used in the conventional way, a refrerence count of 1 implies that the current thread owns the reference and no other thread shares it. This call performs the test for a referenece count of one, and performs the memory barrier needed for the owning thread to act on the object, knowing that it has exclusive access to the object.
| 94 | // to act on the object, knowing that it has exclusive access to the |
| 95 | // object. |
| 96 | inline bool RefCountIsOne(const volatile Atomic32 *ptr) { |
| 97 | bool res = base::subtle::Acquire_Load(ptr) == 1; |
| 98 | if (res) { |
| 99 | ANNOTATE_HAPPENS_AFTER(ptr); |
| 100 | } |
| 101 | return res; |
| 102 | } |
| 103 | |
| 104 | // Return whether the reference count is zero. With conventional object |
| 105 | // referencing counting, the object will be destroyed, so the reference count |
no test coverage detected