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>2020-02-28 08:43:02 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-21 12:57:40 +0300
commit887b6a143b132b1820d161c50d439db38d09aeb1 (patch)
tree2e2e25a2d21d6a0d183ee5cf6fe6f40f0415b4ef /src/node_platform.cc
parent7e0264d9328d823c5f7d49391d5e2ec44d84c35c (diff)
src: allow non-Node.js TracingControllers
We do not need a Node.js-provided `v8::TracingController`, generally. Loosen that restriction in order to make it easier for embedders to provide their own subclass of `v8::TracingController`, or none at all. Refs: https://github.com/electron/electron/commit/9c36576dddfaecde1298ff3e089d21a6e54fe67f PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/node_platform.cc')
-rw-r--r--src/node_platform.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/node_platform.cc b/src/node_platform.cc
index 7628cf5339c..e7c8eadf8f6 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -13,7 +13,6 @@ using v8::Isolate;
using v8::Object;
using v8::Platform;
using v8::Task;
-using node::tracing::TracingController;
namespace {
@@ -325,12 +324,16 @@ void PerIsolatePlatformData::DecreaseHandleCount() {
}
NodePlatform::NodePlatform(int thread_pool_size,
- TracingController* tracing_controller) {
- if (tracing_controller) {
+ v8::TracingController* tracing_controller) {
+ if (tracing_controller != nullptr) {
tracing_controller_ = tracing_controller;
} else {
- tracing_controller_ = new TracingController();
+ tracing_controller_ = new v8::TracingController();
}
+ // TODO(addaleax): It's a bit icky that we use global state here, but we can't
+ // really do anything about it unless V8 starts exposing a way to access the
+ // current v8::Platform instance.
+ tracing::TraceEventHelper::SetTracingController(tracing_controller_);
worker_thread_task_runner_ =
std::make_shared<WorkerThreadsTaskRunner>(thread_pool_size);
}
@@ -518,7 +521,7 @@ double NodePlatform::CurrentClockTimeMillis() {
return SystemClockTimeMillis();
}
-TracingController* NodePlatform::GetTracingController() {
+v8::TracingController* NodePlatform::GetTracingController() {
CHECK_NOT_NULL(tracing_controller_);
return tracing_controller_;
}