• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_CPPGC_UNMARKER_H_
6 #define V8_HEAP_CPPGC_UNMARKER_H_
7 
8 #include "src/heap/cppgc/heap-object-header.h"
9 #include "src/heap/cppgc/heap-visitor.h"
10 
11 namespace cppgc {
12 namespace internal {
13 
14 class SequentialUnmarker final : private HeapVisitor<SequentialUnmarker> {
15   friend class HeapVisitor<SequentialUnmarker>;
16 
17  public:
SequentialUnmarker(RawHeap & heap)18   explicit SequentialUnmarker(RawHeap& heap) { Traverse(heap); }
19 
20  private:
VisitHeapObjectHeader(HeapObjectHeader & header)21   bool VisitHeapObjectHeader(HeapObjectHeader& header) {
22     if (header.IsMarked()) header.Unmark();
23     return true;
24   }
25 };
26 
27 }  // namespace internal
28 }  // namespace cppgc
29 
30 #endif  // V8_HEAP_CPPGC_UNMARKER_H_
31