File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -582,10 +582,6 @@ WallProfiler::WallProfiler(std::chrono::microseconds samplingPeriod,
582
582
}
583
583
}
584
584
585
- WallProfiler::~WallProfiler () {
586
- Dispose (nullptr , true );
587
- }
588
-
589
585
void WallProfiler::Dispose (Isolate* isolate, bool removeFromMap) {
590
586
if (cpuProfiler_ != nullptr ) {
591
587
cpuProfiler_->Dispose ();
@@ -595,7 +591,7 @@ void WallProfiler::Dispose(Isolate* isolate, bool removeFromMap) {
595
591
g_profilers.RemoveProfiler (isolate, this );
596
592
}
597
593
598
- if (isolate != nullptr && collectAsyncId_) {
594
+ if (collectAsyncId_) {
599
595
isolate->RemoveGCPrologueCallback (&GCPrologueCallback, this );
600
596
isolate->RemoveGCEpilogueCallback (&GCEpilogueCallback, this );
601
597
}
@@ -1057,8 +1053,11 @@ NAN_METHOD(WallProfiler::V8ProfilerStuckEventLoopDetected) {
1057
1053
}
1058
1054
1059
1055
NAN_METHOD (WallProfiler::Dispose) {
1060
- // Profiler should already be stopped when this is called.
1061
1056
auto profiler = Nan::ObjectWrap::Unwrap<WallProfiler>(info.This ());
1057
+ // Profiler must already be stopped when this is called.
1058
+ if (profiler->started_ ) {
1059
+ return Nan::ThrowTypeError (" Profiler is still running, stop it first." );
1060
+ }
1062
1061
delete profiler;
1063
1062
}
1064
1063
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class WallProfiler : public Nan::ObjectWrap {
92
92
using ContextBuffer = std::vector<SampleContext>;
93
93
ContextBuffer contexts_;
94
94
95
- ~WallProfiler ();
95
+ ~WallProfiler () = default ;
96
96
void Dispose (v8::Isolate* isolate, bool removeFromMap);
97
97
98
98
// A new CPU profiler object will be created each time profiling is started
You can’t perform that action at this time.
0 commit comments