chromium/v8/include/cppgc/testing.h

// Copyright 2021 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_TESTING_H_
#define INCLUDE_CPPGC_TESTING_H_

#include "cppgc/common.h"
#include "cppgc/macros.h"
#include "v8config.h"  // NOLINT(build/include_directory)

namespace cppgc {

class HeapHandle;

/**
 * Namespace contains testing helpers.
 */
namespace testing {

/**
 * Overrides the state of the stack with the provided value. Parameters passed
 * to explicit garbage collection calls still take precedence. Must not be
 * nested.
 *
 * This scope is useful to make the garbage collector consider the stack when
 * tasks that invoke garbage collection (through the provided platform) contain
 * interesting pointers on its stack.
 */
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {};

/**
 * Testing interface for managed heaps that allows for controlling garbage
 * collection timings. Embedders should use this class when testing the
 * interaction of their code with incremental/concurrent garbage collection.
 */
class V8_EXPORT StandaloneTestingHeap final {};

V8_EXPORT bool IsHeapObjectOld(void*);

}  // namespace testing
}  // namespace cppgc

#endif  // INCLUDE_CPPGC_TESTING_H_