diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2020-01-07 16:18:56 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-01-16 09:38:53 +0300 |
commit | 6050236c3dfa22fd152bfa62e008e8db0d558e1f (patch) | |
tree | fdd07b12695153f6639c0ee6e5f837a1a560f646 /src/env.cc | |
parent | ff60a0e2b15428ab427e15afb9eeb573039c216d (diff) |
src: remove uses of node::InitializeV8Platform()
This requires minor changes to src/env.cc to deal with
`node::tracing::AgentWriterHandle::GetTracingController()` now possibly
returning a nullptr, because the cctest doesn't set one.
It seems plausible to me that embedders won't set one either so that
seems like an okay change to make. It avoids embedders having to track
down nullptr segfaults.
PR-URL: https://github.com/nodejs/node/pull/31245
Refs: https://github.com/nodejs/node/pull/31217
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/env.cc')
-rw-r--r-- | src/env.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/env.cc b/src/env.cc index ff44b0d8af3..8ed6150c720 100644 --- a/src/env.cc +++ b/src/env.cc @@ -332,8 +332,8 @@ Environment::Environment(IsolateData* isolate_data, if (tracing::AgentWriterHandle* writer = GetTracingAgentWriter()) { trace_state_observer_ = std::make_unique<TrackingTraceStateObserver>(this); - TracingController* tracing_controller = writer->GetTracingController(); - tracing_controller->AddTraceStateObserver(trace_state_observer_.get()); + if (TracingController* tracing_controller = writer->GetTracingController()) + tracing_controller->AddTraceStateObserver(trace_state_observer_.get()); } destroy_async_id_list_.reserve(512); @@ -409,8 +409,8 @@ Environment::~Environment() { if (trace_state_observer_) { tracing::AgentWriterHandle* writer = GetTracingAgentWriter(); CHECK_NOT_NULL(writer); - TracingController* tracing_controller = writer->GetTracingController(); - tracing_controller->RemoveTraceStateObserver(trace_state_observer_.get()); + if (TracingController* tracing_controller = writer->GetTracingController()) + tracing_controller->RemoveTraceStateObserver(trace_state_observer_.get()); } delete[] heap_statistics_buffer_; |