src: turn inspector raw pointer into unique_ptr
Use a unique pointer to make ownership clear. PR-URL: https://github.com/nodejs/node/pull/16974 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
This commit is contained in:
parent
81010421c5
commit
c07d1279b2
@ -326,8 +326,9 @@ inline Environment::~Environment() {
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
// Destroy inspector agent before erasing the context.
|
||||
delete inspector_agent_;
|
||||
// Destroy inspector agent before erasing the context. The inspector
|
||||
// destructor depends on the context still being accessible.
|
||||
inspector_agent_.reset(nullptr);
|
||||
#endif
|
||||
|
||||
context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex,
|
||||
|
@ -689,7 +689,7 @@ class Environment {
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
inline inspector::Agent* inspector_agent() const {
|
||||
return inspector_agent_;
|
||||
return inspector_agent_.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -734,7 +734,7 @@ class Environment {
|
||||
std::map<std::string, uint64_t> performance_marks_;
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
inspector::Agent* const inspector_agent_;
|
||||
std::unique_ptr<inspector::Agent> inspector_agent_;
|
||||
#endif
|
||||
|
||||
HandleWrapQueue handle_wrap_queue_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user