Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-10-19 03:24:06 +0300
committerRich Trott <rtrott@gmail.com>2019-10-22 21:51:45 +0300
commit2dc70657a33d19e67fb8db4de4169a11371c5763 (patch)
tree325f2e2c8714a5591ccd110f76f42b4605f11deb /src/node_platform.h
parent45efe67a84d382fed3c86d56f56beffc6bb0a136 (diff)
src: make implementing CancelPendingDelayedTasks for platform optional
Fold `CancelPendingDelayedTasks()` into `UnregisterIsolate()` and make implementing it optional. It makes sense for these two operations to happen at the same time, so it is sufficient to provide a single operation instead of two separate ones. PR-URL: https://github.com/nodejs/node/pull/30034 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Diffstat (limited to 'src/node_platform.h')
-rw-r--r--src/node_platform.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/node_platform.h b/src/node_platform.h
index d2eb325c121..24f7b337bb8 100644
--- a/src/node_platform.h
+++ b/src/node_platform.h
@@ -78,12 +78,12 @@ class PerIsolatePlatformData :
// posted during flushing of the queue are postponed until the next
// flushing.
bool FlushForegroundTasksInternal();
- void CancelPendingDelayedTasks();
const uv_loop_t* event_loop() const { return loop_; }
private:
void DeleteFromScheduledTasks(DelayedTask* task);
+ void DecreaseHandleCount();
static void FlushTasks(uv_async_t* handle);
static void RunForegroundTask(std::unique_ptr<v8::Task> task);
@@ -95,6 +95,9 @@ class PerIsolatePlatformData :
};
typedef std::vector<ShutdownCallback> ShutdownCbList;
ShutdownCbList shutdown_callbacks_;
+ // shared_ptr to self to keep this object alive during shutdown.
+ std::shared_ptr<PerIsolatePlatformData> self_reference_;
+ uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_
uv_loop_t* const loop_;
uv_async_t* flush_tasks_ = nullptr;
@@ -102,7 +105,7 @@ class PerIsolatePlatformData :
TaskQueue<DelayedTask> foreground_delayed_tasks_;
// Use a custom deleter because libuv needs to close the handle first.
- typedef std::unique_ptr<DelayedTask, std::function<void(DelayedTask*)>>
+ typedef std::unique_ptr<DelayedTask, void(*)(DelayedTask*)>
DelayedTaskPointer;
std::vector<DelayedTaskPointer> scheduled_delayed_tasks_;
};
@@ -137,7 +140,6 @@ class NodePlatform : public MultiIsolatePlatform {
~NodePlatform() override = default;
void DrainTasks(v8::Isolate* isolate) override;
- void CancelPendingDelayedTasks(v8::Isolate* isolate) override;
void Shutdown();
// v8::Platform implementation.