| // Copyright 2020 the V8 project 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 V8_HEAP_CPPGC_SWEEPER_H_ |
| #define V8_HEAP_CPPGC_SWEEPER_H_ |
| #include "src/base/macros.h" |
| class ConcurrentSweeperTest; |
| class V8_EXPORT_PRIVATE Sweeper final { |
| enum class SweepingType : uint8_t { kAtomic, kIncrementalAndConcurrent }; |
| enum class CompactableSpaceHandling { kSweep, kIgnore }; |
| SweepingType sweeping_type = SweepingType::kIncrementalAndConcurrent; |
| CompactableSpaceHandling compactable_space_handling = |
| CompactableSpaceHandling::kSweep; |
| Sweeper(RawHeap*, cppgc::Platform*, StatsCollector*); |
| Sweeper(const Sweeper&) = delete; |
| Sweeper& operator=(const Sweeper&) = delete; |
| // Sweeper::Start assumes the heap holds no linear allocation buffers. |
| void Start(SweepingConfig); |
| void WaitForConcurrentSweepingForTesting(); |
| std::unique_ptr<SweeperImpl> impl_; |
| friend class ConcurrentSweeperTest; |
| #endif // V8_HEAP_CPPGC_SWEEPER_H_ |