v8  9.0.257(node16.0.0)
V8 is Google's open source JavaScript engine
testing.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_TESTING_H_
6 #define INCLUDE_CPPGC_TESTING_H_
7 
8 #include "cppgc/common.h"
9 #include "cppgc/macros.h"
10 #include "v8config.h" // NOLINT(build/include_directory)
11 
12 namespace cppgc {
13 
14 class HeapHandle;
15 
16 /**
17  * Namespace contains testing helpers.
18  */
19 namespace testing {
20 
21 /**
22  * Overrides the state of the stack with the provided value. Takes precedence
23  * over other parameters that set the stack state. Must no be nested.
24  */
25 class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
27 
28  public:
29  /**
30  * Constructs a scoped object that automatically enters and leaves the scope.
31  *
32  * \param heap_handle The corresponding heap.
33  */
34  explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle,
35  EmbedderStackState state);
37 
38  OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) =
39  delete;
40  OverrideEmbedderStackStateScope& operator=(
41  const OverrideEmbedderStackStateScope&) = delete;
42 
43  private:
44  HeapHandle& heap_handle_;
45 };
46 
47 } // namespace testing
48 } // namespace cppgc
49 
50 #endif // INCLUDE_CPPGC_TESTING_H_
cppgc::testing
Definition: testing.h:19
cppgc::testing::OverrideEmbedderStackStateScope::~OverrideEmbedderStackStateScope
~OverrideEmbedderStackStateScope()
cppgc
Definition: allocation.h:17
V8_NODISCARD
#define V8_NODISCARD
Definition: v8config.h:468
V8_EXPORT
#define V8_EXPORT
Definition: v8config.h:512
CPPGC_STACK_ALLOCATED
#define CPPGC_STACK_ALLOCATED()
Definition: macros.h:15
cppgc::testing::OverrideEmbedderStackStateScope::operator=
OverrideEmbedderStackStateScope & operator=(const OverrideEmbedderStackStateScope &)=delete
cppgc::testing::OverrideEmbedderStackStateScope::OverrideEmbedderStackStateScope
OverrideEmbedderStackStateScope(HeapHandle &heap_handle, EmbedderStackState state)
cppgc::EmbedderStackState
EmbedderStackState
Definition: common.h:16
cppgc::testing::OverrideEmbedderStackStateScope::OverrideEmbedderStackStateScope
OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope &)=delete