summaryrefslogtreecommitdiff
path: root/chromium/v8/include/cppgc/internal/process-heap.h
blob: 0f742a50a9cb978d210edb29a2664fec3406b4a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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 INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_
#define INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_

#include "cppgc/internal/atomic-entry-flag.h"
#include "v8config.h"  // NOLINT(build/include_directory)

namespace cppgc {
namespace internal {

class V8_EXPORT ProcessHeap final {
 public:
  static void EnterIncrementalOrConcurrentMarking() {
    concurrent_marking_flag_.Enter();
  }
  static void ExitIncrementalOrConcurrentMarking() {
    concurrent_marking_flag_.Exit();
  }

  static bool IsAnyIncrementalOrConcurrentMarking() {
    return concurrent_marking_flag_.MightBeEntered();
  }

 private:
  static AtomicEntryFlag concurrent_marking_flag_;
};

}  // namespace internal
}  // namespace cppgc

#endif  // INCLUDE_CPPGC_INTERNAL_PROCESS_HEAP_H_