Loading...
Searching...
No Matches
v8-embedder-state-scope.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_V8_EMBEDDER_STATE_SCOPE_H_
6#define INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
7
8#include <memory>
9
10#include "v8-internal.h" // NOLINT(build/include_directory)
11#include "v8-local-handle.h" // NOLINT(build/include_directory)
12
13namespace v8 {
14
15class Context;
16
17namespace internal {
18class EmbedderState;
19} // namespace internal
20
21// A StateTag represents a possible state of the embedder.
22enum class EmbedderStateTag : uint8_t {
23 // reserved
24 EMPTY = 0,
25 OTHER = 1,
26 // embedder can define any state after
27};
28
29// A stack-allocated class that manages an embedder state on the isolate.
30// After an EmbedderState scope has been created, a new embedder state will be
31// pushed on the isolate stack.
33 public:
36
38
39 private:
40 // Declaring operator new and delete as deleted is not spec compliant.
41 // Therefore declare them private instead to disable dynamic alloc
42 void* operator new(size_t size);
43 void* operator new[](size_t size);
44 void operator delete(void*, size_t);
45 void operator delete[](void*, size_t);
46
47 std::unique_ptr<internal::EmbedderState> embedder_state_;
48};
49
50} // namespace v8
51
52#endif // INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
Definition: v8-embedder-state-scope.h:32
EmbedderStateScope(Isolate *isolate, Local< v8::Context > context, EmbedderStateTag tag)
Definition: v8-isolate.h:212
Definition: v8-local-handle.h:266
Definition: libplatform.h:15
EmbedderStateTag
Definition: v8-embedder-state-scope.h:22
@ OTHER
Definition: v8-unwinder.h:42
#define V8_EXPORT
Definition: v8config.h:793