mirror of
https://github.com/nodejs/node.git
synced 2025-05-22 23:59:49 +00:00

PR-URL: https://github.com/nodejs/node/pull/37587 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
// 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. Takes precedence
|
|
* over other parameters that set the stack state. Must no be nested.
|
|
*/
|
|
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
|
|
CPPGC_STACK_ALLOCATED();
|
|
|
|
public:
|
|
/**
|
|
* Constructs a scoped object that automatically enters and leaves the scope.
|
|
*
|
|
* \param heap_handle The corresponding heap.
|
|
*/
|
|
explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle,
|
|
EmbedderStackState state);
|
|
~OverrideEmbedderStackStateScope();
|
|
|
|
OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) =
|
|
delete;
|
|
OverrideEmbedderStackStateScope& operator=(
|
|
const OverrideEmbedderStackStateScope&) = delete;
|
|
|
|
private:
|
|
HeapHandle& heap_handle_;
|
|
};
|
|
|
|
} // namespace testing
|
|
} // namespace cppgc
|
|
|
|
#endif // INCLUDE_CPPGC_TESTING_H_
|