| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef COMPONENTS_VIZ_COMMON_SURFACES_SUBTREE_CAPTURE_ID_ALLOCATOR_H_ |
| #define COMPONENTS_VIZ_COMMON_SURFACES_SUBTREE_CAPTURE_ID_ALLOCATOR_H_ |
| |
| #include <cstdint> |
| |
| #include "components/viz/common/surfaces/subtree_capture_id.h" |
| |
| namespace viz { |
| |
| // Generates SubtreeCaptureId's by incrementally increasing the subtree_id's. |
| class VIZ_COMMON_EXPORT SubtreeCaptureIdAllocator { |
| public: |
| SubtreeCaptureIdAllocator() = default; |
| SubtreeCaptureIdAllocator(const SubtreeCaptureIdAllocator&) = delete; |
| SubtreeCaptureIdAllocator& operator=(const SubtreeCaptureIdAllocator&) = |
| delete; |
| ~SubtreeCaptureIdAllocator() = default; |
| |
| SubtreeCaptureId NextSubtreeCaptureId() { |
| return SubtreeCaptureId(next_subtree_id_++); |
| } |
| |
| private: |
| uint32_t next_subtree_id_ = 1u; |
| }; |
| |
| } // namespace viz |
| |
| #endif // COMPONENTS_VIZ_COMMON_SURFACES_SUBTREE_CAPTURE_ID_ALLOCATOR_H_ |