diff --git a/ecmascript/tooling/agent/heapprofiler_impl.h b/ecmascript/tooling/agent/heapprofiler_impl.h index 38bb317fc920706b8510b7e34ce5f4fffeba798d..bc2d77aa404681c2d8c1407b32a5fcfcde1caa71 100644 --- a/ecmascript/tooling/agent/heapprofiler_impl.h +++ b/ecmascript/tooling/agent/heapprofiler_impl.h @@ -100,7 +100,7 @@ public: bool WriteChunk(char* data, int size) override { auto ecmaVm = static_cast(frontend_)->GetEcmaVM(); - frontend_->SendNotification(ecmaVm, AddHeapSnapshotChunk::Create(data, size)); + frontend_->SendProfilerNotify(ecmaVm, AddHeapSnapshotChunk::Create(data, size)); return true; } bool Good() override @@ -129,7 +129,7 @@ public: if (done == total) { reportHeapSnapshotProgress->SetFinished(true); } - frontend_->SendNotification(ecmaVm, std::move(reportHeapSnapshotProgress)); + frontend_->SendProfilerNotify(ecmaVm, std::move(reportHeapSnapshotProgress)); } private: diff --git a/ecmascript/tooling/front_end.h b/ecmascript/tooling/front_end.h index 826af75baa1d2de6f29e230ff00a59ecea4b8da0..b41870a4ddde04691fcbd8dbd8e50c4e569e311e 100644 --- a/ecmascript/tooling/front_end.h +++ b/ecmascript/tooling/front_end.h @@ -32,6 +32,7 @@ public: virtual void SendResponse(const DispatchRequest &request, const DispatchResponse &response, std::unique_ptr result) = 0; virtual void SendNotification(const EcmaVM *ecmaVm, std::unique_ptr events) = 0; + virtual void SendProfilerNotify(const EcmaVM *ecmaVm, std::unique_ptr events) = 0; private: NO_COPY_SEMANTIC(FrontEnd); diff --git a/ecmascript/tooling/protocol_handler.cpp b/ecmascript/tooling/protocol_handler.cpp index f64a399b08d21e648dac7641cb6e93375d95a933..3d7c560d70f04e2e68756a7a2f4a5088c57133da 100644 --- a/ecmascript/tooling/protocol_handler.cpp +++ b/ecmascript/tooling/protocol_handler.cpp @@ -77,7 +77,15 @@ void ProtocolHandler::SendResponse(const DispatchRequest &request, const Dispatc void ProtocolHandler::SendNotification(const EcmaVM *ecmaVm, std::unique_ptr events) { - if (!ecmaVm->GetJsDebuggerManager()->IsDebugMode() || events == nullptr) { + if (!ecmaVm->GetJsDebuggerManager()->IsDebugMode()) { + return; + } + SendProfilerNotify(ecmaVm, std::move(events)); +} + +void ProtocolHandler::SendProfilerNotify(const EcmaVM *ecmaVm, std::unique_ptr events) +{ + if (events == nullptr) { return; } LOG(DEBUG, DEBUGGER) << "ProtocolHandler::SendNotification: " << events->GetName(); diff --git a/ecmascript/tooling/protocol_handler.h b/ecmascript/tooling/protocol_handler.h index 6373311cb21cb0ce05aa136f6ac3bec8d475d7ec..5be754cad130734cae57340a41d01d80316dd122 100644 --- a/ecmascript/tooling/protocol_handler.h +++ b/ecmascript/tooling/protocol_handler.h @@ -34,6 +34,7 @@ public: void SendResponse(const DispatchRequest &request, const DispatchResponse &response, std::unique_ptr result) override; void SendNotification(const EcmaVM *ecmaVm, std::unique_ptr events) override; + void SendProfilerNotify(const EcmaVM *ecmaVm, std::unique_ptr events) override; const EcmaVM *GetEcmaVM() const { return vm_;