chromium/third_party/blink/renderer/platform/wtf/bit_field.h

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_BIT_FIELD_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_BIT_FIELD_H_

#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/atomic_operations.h"

namespace WTF {

enum class BitFieldValueConstness {};

namespace internal {

template <class BitFieldType>
class BitFieldBase;

// Helper class for defining values in a bit field. This helper provides
// utilities to read, write and update the value in the bit field.
template <class ValueType,
          size_t offset,
          size_t size,
          class BitFieldType,
          BitFieldValueConstness is_const = BitFieldValueConstness::kNonConst>
class BitFieldValue final {};

}  // namespace internal

// BitField intended to be used by a single thread.
template <class BitFieldType>
class WTF_EXPORT SingleThreadedBitField {};

// BitField that can be written by a single thread but read by multiple threads.
template <class BitFieldType>
class WTF_EXPORT ConcurrentlyReadBitField
    : public SingleThreadedBitField<BitFieldType> {};

}  // namespace WTF

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_BIT_FIELD_H_