| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 11650c6 commit bd55a9a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -222,7 +222,7 @@ int WorkerThreadsTaskRunner::NumberOfWorkerThreads() const { | |||
| 222 | 222 | ||
| 223 | 223 | PerIsolatePlatformData::PerIsolatePlatformData( | |
| 224 | 224 | Isolate* isolate, uv_loop_t* loop) | |
| 225 | - : loop_(loop) { | ||
| 225 | + : isolate_(isolate), loop_(loop) { | ||
| 226 | 226 | flush_tasks_ = new uv_async_t(); | |
| 227 | 227 | CHECK_EQ(0, uv_async_init(loop, flush_tasks_, FlushTasks)); | |
| 228 | 228 | flush_tasks_->data = static_cast<void*>(this); | |
@@ -372,12 +372,11 @@ int NodePlatform::NumberOfWorkerThreads() { | |||
| 372 | 372 | } | |
| 373 | 373 | ||
| 374 | 374 | void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<Task> task) { | |
| 375 | - Isolate* isolate = Isolate::GetCurrent(); | ||
| 376 | - DebugSealHandleScope scope(isolate); | ||
| 377 | - Environment* env = Environment::GetCurrent(isolate); | ||
| 375 | + DebugSealHandleScope scope(isolate_); | ||
| 376 | + Environment* env = Environment::GetCurrent(isolate_); | ||
| 378 | 377 | if (env != nullptr) { | |
| 379 | - v8::HandleScope scope(isolate); | ||
| 380 | - InternalCallbackScope cb_scope(env, Object::New(isolate), { 0, 0 }, | ||
| 378 | + v8::HandleScope scope(isolate_); | ||
| 379 | + InternalCallbackScope cb_scope(env, Object::New(isolate_), { 0, 0 }, | ||
| 381 | 380 | InternalCallbackScope::kNoFlags); | |
| 382 | 381 | task->Run(); | |
| 383 | 382 | } else { | |
@@ -396,8 +395,8 @@ void PerIsolatePlatformData::DeleteFromScheduledTasks(DelayedTask* task) { | |||
| 396 | 395 | } | |
| 397 | 396 | ||
| 398 | 397 | void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { | |
| 399 | - DelayedTask* delayed = static_cast<DelayedTask*>(handle->data); | ||
| 400 | - RunForegroundTask(std::move(delayed->task)); | ||
| 398 | + DelayedTask* delayed = ContainerOf(&DelayedTask::timer, handle); | ||
| 399 | + delayed->platform_data->RunForegroundTask(std::move(delayed->task)); | ||
| 401 | 400 | delayed->platform_data->DeleteFromScheduledTasks(delayed); | |
| 402 | 401 | } | |
| 403 | 402 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,7 +86,7 @@ class PerIsolatePlatformData : | |||
| 86 | 86 | void DecreaseHandleCount(); | |
| 87 | 87 | ||
| 88 | 88 | static void FlushTasks(uv_async_t* handle); | |
| 89 | - static void RunForegroundTask(std::unique_ptr<v8::Task> task); | ||
| 89 | + void RunForegroundTask(std::unique_ptr<v8::Task> task); | ||
| 90 | 90 | static void RunForegroundTask(uv_timer_t* timer); | |
| 91 | 91 | ||
| 92 | 92 | struct ShutdownCallback { | |
@@ -99,6 +99,7 @@ class PerIsolatePlatformData : | |||
| 99 | 99 | std::shared_ptr<PerIsolatePlatformData> self_reference_; | |
| 100 | 100 | uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_ | |
| 101 | 101 | ||
| 102 | + v8::Isolate* const isolate_; | ||
| 102 | 103 | uv_loop_t* const loop_; | |
| 103 | 104 | uv_async_t* flush_tasks_ = nullptr; | |
| 104 | 105 | TaskQueue<v8::Task> foreground_tasks_; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments