crashpad::InitializationState Class Reference

Tracks whether data are initialized. More...

`#include "util/misc/initialization_state.h"`

Inheritance diagram for crashpad::InitializationState:

## Public Types

enum | State : uint8_t
| The object’s state. More...

## Public Member Functions

bool | is_uninitialized () const
| Returns `true` if the object’s state is kStateUninitialized and it is safe to begin initializing it.
void | set_invalid ()
| Sets the object’s state to kStateInvalid, marking initialization as being in process.
void | set_valid ()
| Sets the object’s state to kStateValid, marking it initialized.
bool | is_valid () const
| Returns `true` if the the object’s state is kStateValid and it has been fully initialized and may be used.

## Protected Member Functions

State | state () const
| Returns the object’s state. More...
void | set_state (State state)
| Sets the object’s state. More...

## Detailed Description

Tracks whether data are initialized.

Objects of this type track whether the data they’re guarding are initialized. The three possible states are uninitialized (the initial state), initializing, and valid. As the guarded data are initialized, an InitializationState object will normally transition through these three states. A fourth state corresponds to the destruction of objects of this type, making it less likely that a use-after-free of an InitializationState object will appear in the valid state.

If the only purpose for tracking the initialization state of guarded data is to DCHECK when the object is in an unexpected state, use InitializationStateDcheck instead.

## Member Enumeration Documentation

## State

enum crashpad::InitializationState::State : uint8_t

The object’s state.

Enumerator
kStateUninitialized | The object has not yet been initialized.
kStateInvalid | The object is being initialized. This state protects against attempted reinitializaton of partially-initialized objects whose initial initialization attempt failed. This state is to be used while objects are initializing, but are not yet fully initialized.
kStateValid | The object has been initialized.
kStateDestroyed | The object has been destroyed.

## Member Function Documentation

## set_state()

void crashpad::InitializationState::set_state | ( | State | state | ) |

inlineprotected

Sets the object’s state.

Consumers of this class should use a set_state_*() method instead.

## state()

State crashpad::InitializationState::state | ( |  | ) | const

inlineprotected

Returns the object’s state.

Consumers of this class should use an is_state_*() method instead.

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

- util/misc/initialization_state.h