Skip to content

Commit 1d454b7

Browse files
committed
feat(v8): add move and copy delete to v8 scope classes
1 parent b96ab8a commit 1d454b7

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/v8/V8Scope.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace jse {
1313

1414

15-
class EnterV8Scope {
15+
class EnterV8Scope final {
1616
v8::Locker locker_;
1717
v8::Isolate::Scope isolateScope_;
1818
v8::HandleScope handleScope_;
@@ -24,29 +24,44 @@ class EnterV8Scope {
2424
isolateScope_(isolate),
2525
handleScope_(isolate),
2626
contextScope_(context) {}
27+
28+
EnterV8Scope(const EnterV8Scope&) = delete;
29+
EnterV8Scope& operator=(const EnterV8Scope&) = delete;
30+
EnterV8Scope(EnterV8Scope&&) = delete;
31+
EnterV8Scope& operator=(EnterV8Scope&&) = delete;
2732
};
2833

29-
class ExitV8Scope {
34+
class ExitV8Scope final {
3035
v8::Unlocker locker_;
3136

3237
public:
3338
explicit ExitV8Scope(v8::Isolate* isolate) : locker_(isolate) {}
39+
40+
ExitV8Scope(const ExitV8Scope&) = delete;
41+
ExitV8Scope& operator=(const ExitV8Scope&) = delete;
42+
ExitV8Scope(ExitV8Scope&&) = delete;
43+
ExitV8Scope& operator=(ExitV8Scope&&) = delete;
3444
};
3545

36-
class HandleV8Scope {
46+
class HandleV8Scope final {
3747
v8::EscapableHandleScope handleScope_;
3848

3949
public:
4050
explicit HandleV8Scope(v8::Isolate* isolate) : handleScope_(isolate) {}
4151

52+
HandleV8Scope(const HandleV8Scope&) = delete;
53+
HandleV8Scope& operator=(const HandleV8Scope&) = delete;
54+
HandleV8Scope(HandleV8Scope&&) = delete;
55+
HandleV8Scope& operator=(HandleV8Scope&&) = delete;
56+
4257
template <typename T>
4358
v8::Local<v8::Value> Escape(v8::Local<T> value) {
4459
return handleScope_.Escape(value);
4560
}
4661
};
4762

4863

49-
inline void HandleV8Exception(v8::Isolate* isolate, v8::Local<v8::Context> ctx, v8::TryCatch& vtry) {
64+
inline void CheckV8Exception(v8::Isolate* isolate, v8::Local<v8::Context> ctx, v8::TryCatch& vtry) {
5065
if (vtry.HasCaught()) {
5166
v8::String::Utf8Value exception(isolate, vtry.Exception());
5267
v8::String::Utf8Value stack(isolate, vtry.StackTrace(ctx).ToLocalChecked());

0 commit comments

Comments
 (0)