Chromium Embedded Framework (CEF)  115.2.0+g096e3eb+chromium-115.0.5790.13
base::AtomicRefCount Class Reference

#include "include/base/cef_atomic_ref_count.h"

Public Member Functions

constexpr AtomicRefCount ()
 
constexpr AtomicRefCount (int initial_value)
 
int Increment ()
 Increment a reference count. More...
 
int Increment (int increment)
 Increment a reference count by "increment", which must exceed 0. More...
 
bool Decrement ()
 Decrement a reference count, and return whether the result is non-zero. More...
 
bool IsOne () const
 Return whether the reference count is one. More...
 
bool IsZero () const
 Return whether the reference count is zero. More...
 
int SubtleRefCountForDebug () const
 Returns the current reference count (with no barriers). More...
 

Constructor & Destructor Documentation

◆ AtomicRefCount() [1/2]

constexpr base::AtomicRefCount::AtomicRefCount ( )
inlineconstexpr

◆ AtomicRefCount() [2/2]

constexpr base::AtomicRefCount::AtomicRefCount ( int  initial_value)
inlineexplicitconstexpr

Member Function Documentation

◆ Decrement()

bool base::AtomicRefCount::Decrement ( )
inline

Decrement a reference count, and return whether the result is non-zero.

Insert barriers to ensure that state written before the reference count became zero will be visible to a thread that has just made the count zero.

◆ Increment() [1/2]

int base::AtomicRefCount::Increment ( )
inline

Increment a reference count.

Returns the previous value of the count.

◆ Increment() [2/2]

int base::AtomicRefCount::Increment ( int  increment)
inline

Increment a reference count by "increment", which must exceed 0.

Returns the previous value of the count.

◆ IsOne()

bool base::AtomicRefCount::IsOne ( ) const
inline

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 reference 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.

◆ IsZero()

bool base::AtomicRefCount::IsZero ( ) const
inline

Return whether the reference count is zero.

With conventional object referencing counting, the object will be destroyed, so the reference count should never be zero. Hence this is generally used for a debug check.

◆ SubtleRefCountForDebug()

int base::AtomicRefCount::SubtleRefCountForDebug ( ) const
inline

Returns the current reference count (with no barriers).

This is subtle, and should be used only for debugging.


The documentation for this class was generated from the following file: