Loading...
Searching...
No Matches
heap-state.h
Go to the documentation of this file.
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 INCLUDE_CPPGC_HEAP_STATE_H_
6#define INCLUDE_CPPGC_HEAP_STATE_H_
7
8#include "v8config.h" // NOLINT(build/include_directory)
9
10namespace cppgc {
11
12class HeapHandle;
13
14namespace subtle {
15
19class V8_EXPORT HeapState final {
20 public:
29 static bool IsMarking(const HeapHandle& heap_handle);
30
31 /*
32 * Returns whether the garbage collector is sweeping. This API is experimental
33 * and is expected to be removed in future.
34 *
35 * \param heap_handle The corresponding heap.
36 * \returns true if the garbage collector is currently sweeping, and false
37 * otherwise.
38 */
39 static bool IsSweeping(const HeapHandle& heap_handle);
40
41 /*
42 * Returns whether the garbage collector is currently sweeping on the thread
43 * owning this heap. This API allows the caller to determine whether it has
44 * been called from a destructor of a managed object. This API is experimental
45 * and may be removed in future.
46 *
47 * \param heap_handle The corresponding heap.
48 * \returns true if the garbage collector is currently sweeping on this
49 * thread, and false otherwise.
50 */
51 static bool IsSweepingOnOwningThread(const HeapHandle& heap_handle);
52
62 static bool IsInAtomicPause(const HeapHandle& heap_handle);
63
73 static bool PreviousGCWasConservative(const HeapHandle& heap_handle);
74
75 private:
76 HeapState() = delete;
77};
78
79} // namespace subtle
80} // namespace cppgc
81
82#endif // INCLUDE_CPPGC_HEAP_STATE_H_
Definition: heap-handle.h:21
Definition: heap-state.h:19
static bool IsSweeping(const HeapHandle &heap_handle)
static bool IsMarking(const HeapHandle &heap_handle)
static bool PreviousGCWasConservative(const HeapHandle &heap_handle)
static bool IsSweepingOnOwningThread(const HeapHandle &heap_handle)
static bool IsInAtomicPause(const HeapHandle &heap_handle)
Definition: allocation.h:38
#define V8_EXPORT
Definition: v8config.h:762