| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8e7204e commit edc4af0
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,6 @@ using v8::MaybeLocal; | |||
| 23 | 23 | using v8::Message; | |
| 24 | 24 | using v8::MicrotasksPolicy; | |
| 25 | 25 | using v8::ObjectTemplate; | |
| 26 | - using v8::SealHandleScope; | ||
| 27 | 26 | using v8::String; | |
| 28 | 27 | using v8::Value; | |
| 29 | 28 | ||
@@ -35,9 +34,7 @@ static bool AllowWasmCodeGenerationCallback(Local<Context> context, | |||
| 35 | 34 | } | |
| 36 | 35 | ||
| 37 | 36 | static bool ShouldAbortOnUncaughtException(Isolate* isolate) { | |
| 38 | - #ifdef DEBUG | ||
| 39 | - SealHandleScope scope(isolate); | ||
| 40 | - #endif | ||
| 37 | + DebugSealHandleScope scope(isolate); | ||
| 41 | 38 | Environment* env = Environment::GetCurrent(isolate); | |
| 42 | 39 | return env != nullptr && | |
| 43 | 40 | (env->is_main_thread() || !env->is_stopping_worker()) && | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | #include "env-inl.h" | |
| 2 | - #include "node.h" | ||
| 2 | + #include "node_internals.h" | ||
| 3 | 3 | #include "node_process.h" | |
| 4 | 4 | #include "async_wrap.h" | |
| 5 | 5 | ||
@@ -11,7 +11,6 @@ using v8::Integer; | |||
| 11 | 11 | using v8::Isolate; | |
| 12 | 12 | using v8::Local; | |
| 13 | 13 | using v8::Object; | |
| 14 | - using v8::SealHandleScope; | ||
| 15 | 14 | using v8::String; | |
| 16 | 15 | using v8::Value; | |
| 17 | 16 | using v8::NewStringType; | |
@@ -116,9 +115,7 @@ async_context EmitAsyncInit(Isolate* isolate, | |||
| 116 | 115 | Local<Object> resource, | |
| 117 | 116 | Local<String> name, | |
| 118 | 117 | async_id trigger_async_id) { | |
| 119 | - #ifdef DEBUG | ||
| 120 | - SealHandleScope handle_scope(isolate); | ||
| 121 | - #endif | ||
| 118 | + DebugSealHandleScope handle_scope(isolate); | ||
| 122 | 119 | Environment* env = Environment::GetCurrent(isolate); | |
| 123 | 120 | CHECK_NOT_NULL(env); | |
| 124 | 121 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -644,9 +644,7 @@ void Environment::RunAndClearNativeImmediates() { | |||
| 644 | 644 | auto drain_list = [&]() { | |
| 645 | 645 | TryCatchScope try_catch(this); | |
| 646 | 646 | for (auto it = list.begin(); it != list.end(); ++it) { | |
| 647 | - #ifdef DEBUG | ||
| 648 | - v8::SealHandleScope seal_handle_scope(isolate()); | ||
| 649 | - #endif | ||
| 647 | + DebugSealHandleScope seal_handle_scope(isolate()); | ||
| 650 | 648 | it->cb_(this, it->data_); | |
| 651 | 649 | if (it->refed_) | |
| 652 | 650 | ref_count++; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -217,6 +217,20 @@ class InternalCallbackScope { | |||
| 217 | 217 | bool closed_ = false; | |
| 218 | 218 | }; | |
| 219 | 219 | ||
| 220 | + class DebugSealHandleScope { | ||
| 221 | + public: | ||
| 222 | + explicit inline DebugSealHandleScope(v8::Isolate* isolate) | ||
| 223 | + #ifdef DEBUG | ||
| 224 | + : actual_scope_(isolate) | ||
| 225 | + #endif | ||
| 226 | + {} | ||
| 227 | + | ||
| 228 | + private: | ||
| 229 | + #ifdef DEBUG | ||
| 230 | + v8::SealHandleScope actual_scope_; | ||
| 231 | + #endif | ||
| 232 | + }; | ||
| 233 | + | ||
| 220 | 234 | class ThreadPoolWork { | |
| 221 | 235 | public: | |
| 222 | 236 | explicit inline ThreadPoolWork(Environment* env) : env_(env) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ using v8::Isolate; | |||
| 12 | 12 | using v8::Local; | |
| 13 | 13 | using v8::Object; | |
| 14 | 14 | using v8::Platform; | |
| 15 | - using v8::SealHandleScope; | ||
| 16 | 15 | using v8::Task; | |
| 17 | 16 | using node::tracing::TracingController; | |
| 18 | 17 | ||
@@ -332,9 +331,7 @@ int NodePlatform::NumberOfWorkerThreads() { | |||
| 332 | 331 | ||
| 333 | 332 | void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<Task> task) { | |
| 334 | 333 | Isolate* isolate = Isolate::GetCurrent(); | |
| 335 | - #ifdef DEBUG | ||
| 336 | - SealHandleScope scope(isolate); | ||
| 337 | - #endif | ||
| 334 | + DebugSealHandleScope scope(isolate); | ||
| 338 | 335 | Environment* env = Environment::GetCurrent(isolate); | |
| 339 | 336 | if (env != nullptr) { | |
| 340 | 337 | InternalCallbackScope cb_scope(env, Local<Object>(), { 0, 0 }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,39 +113,29 @@ inline void StreamResource::RemoveStreamListener(StreamListener* listener) { | |||
| 113 | 113 | } | |
| 114 | 114 | ||
| 115 | 115 | inline uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) { | |
| 116 | - #ifdef DEBUG | ||
| 117 | - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 118 | - #endif | ||
| 116 | + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 119 | 117 | return listener_->OnStreamAlloc(suggested_size); | |
| 120 | 118 | } | |
| 121 | 119 | ||
| 122 | 120 | inline void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) { | |
| 123 | - #ifdef DEBUG | ||
| 124 | - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 125 | - #endif | ||
| 121 | + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 126 | 122 | if (nread > 0) | |
| 127 | 123 | bytes_read_ += static_cast<uint64_t>(nread); | |
| 128 | 124 | listener_->OnStreamRead(nread, buf); | |
| 129 | 125 | } | |
| 130 | 126 | ||
| 131 | 127 | inline void StreamResource::EmitAfterWrite(WriteWrap* w, int status) { | |
| 132 | - #ifdef DEBUG | ||
| 133 | - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 134 | - #endif | ||
| 128 | + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 135 | 129 | listener_->OnStreamAfterWrite(w, status); | |
| 136 | 130 | } | |
| 137 | 131 | ||
| 138 | 132 | inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { | |
| 139 | - #ifdef DEBUG | ||
| 140 | - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 141 | - #endif | ||
| 133 | + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 142 | 134 | listener_->OnStreamAfterShutdown(w, status); | |
| 143 | 135 | } | |
| 144 | 136 | ||
| 145 | 137 | inline void StreamResource::EmitWantsWrite(size_t suggested_size) { | |
| 146 | - #ifdef DEBUG | ||
| 147 | - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 148 | - #endif | ||
| 138 | + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); | ||
| 149 | 139 | listener_->OnStreamWantsWrite(suggested_size); | |
| 150 | 140 | } | |
| 151 | 141 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments