| 318 | } |
| 319 | |
| 320 | ABSL_MUST_USE_RESULT |
| 321 | inline bool StrengthenRef(const ReferenceCount& refcount) noexcept { |
| 322 | auto count = refcount.strong_refcount_.load(std::memory_order_relaxed); |
| 323 | while (true) { |
| 324 | ABSL_DCHECK_GE(count, 0); |
| 325 | ABSL_ASSUME(count >= 0); |
| 326 | if (count == 0) { |
| 327 | return false; |
| 328 | } |
| 329 | if (refcount.strong_refcount_.compare_exchange_weak( |
| 330 | count, count + 1, std::memory_order_release, |
| 331 | std::memory_order_relaxed)) { |
| 332 | return true; |
| 333 | } |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | ABSL_MUST_USE_RESULT |
| 338 | inline bool StrengthenRef( |