From f295feb968e681dc738a591f6029b158f6c0109e Mon Sep 17 00:00:00 2001 From: Lalit Maganti Date: Thu, 14 Nov 2024 15:27:24 +0000 Subject: [PATCH] ui: tp: plumb errors in NotifyEndOfFile into UI Change-Id: I936bace66febc7c25cf003e9e2785055997ec135 --- .../trace_processor/trace_processor.proto | 8 +++++++- .../trace_processor.descriptor | Bin 7773 -> 7907 bytes src/trace_processor/rpc/rpc.cc | 6 +++++- ui/src/trace_processor/engine.ts | 14 +++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/protos/perfetto/trace_processor/trace_processor.proto b/protos/perfetto/trace_processor/trace_processor.proto index bfb2a1f697..86b49186c0 100644 --- a/protos/perfetto/trace_processor/trace_processor.proto +++ b/protos/perfetto/trace_processor/trace_processor.proto @@ -155,6 +155,8 @@ message TraceProcessorRpc { StatusResult status = 210; // For TPM_REGISTER_SQL_PACKAGE. RegisterSqlPackageResult register_sql_package_result = 211; + // For TPM_FINALIZE_TRACE_DATA. + FinalizeDataResult finalize_data_result = 212; } // Previously: RawQueryArgs for TPM_QUERY_RAW_DEPRECATED @@ -356,4 +358,8 @@ message RegisterSqlPackageArgs { message RegisterSqlPackageResult { optional string error = 1; -} \ No newline at end of file +} + +message FinalizeDataResult { + optional string error = 1; +} diff --git a/python/perfetto/trace_processor/trace_processor.descriptor b/python/perfetto/trace_processor/trace_processor.descriptor index 976fb9b24580d975b78c8e70d7278122a07f818a..40cec3567b2e4f0d2daca016b178f5e2538b3f19 100644 GIT binary patch delta 139 zcmca>^VoL78E%%TYFwt18MzfEf8f5$)Xl&7JWn2Lh)@KVNLprIVoqjNYJ5s!Nn(6a zYH?{!iNqB~1x5{SBW1mU)S|T1l9GJAf};GA{9-*fsA?CW;vleE55^!Nm>D3^&E`T6 RxdoK8xP*|^PW~gC2mp}xF_-`V delta 37 vcmV+=0NVfKJ>5L8%nJmMB?>i@0Sh3L@C)4nu@1A(3~mLpmlE3xlb#+$85$0H diff --git a/src/trace_processor/rpc/rpc.cc b/src/trace_processor/rpc/rpc.cc index 49feef3568..d26cdc1a7a 100644 --- a/src/trace_processor/rpc/rpc.cc +++ b/src/trace_processor/rpc/rpc.cc @@ -212,7 +212,11 @@ void Rpc::ParseRpcRequest(const uint8_t* data, size_t len) { } case RpcProto::TPM_FINALIZE_TRACE_DATA: { Response resp(tx_seq_id_++, req_type); - NotifyEndOfFile(); + auto* result = resp->set_finalize_data_result(); + base::Status res = NotifyEndOfFile(); + if (!res.ok()) { + result->set_error(res.message()); + } resp.Send(rpc_response_fn_); break; } diff --git a/ui/src/trace_processor/engine.ts b/ui/src/trace_processor/engine.ts index ccb8a036ce..58a3705bbe 100644 --- a/ui/src/trace_processor/engine.ts +++ b/ui/src/trace_processor/engine.ts @@ -208,7 +208,7 @@ export abstract class EngineBase implements Engine, Disposable { let isFinalResponse = true; switch (rpc.response) { - case TPM.TPM_APPEND_TRACE_DATA: + case TPM.TPM_APPEND_TRACE_DATA: { const appendResult = assertExists(rpc.appendResult); const pendingPromise = assertExists(this.pendingParses.shift()); if (exists(appendResult.error) && appendResult.error.length > 0) { @@ -217,9 +217,17 @@ export abstract class EngineBase implements Engine, Disposable { pendingPromise.resolve(); } break; - case TPM.TPM_FINALIZE_TRACE_DATA: - assertExists(this.pendingEOFs.shift()).resolve(); + } + case TPM.TPM_FINALIZE_TRACE_DATA: { + const finalizeResult = assertExists(rpc.finalizeDataResult); + const pendingPromise = assertExists(this.pendingEOFs.shift()); + if (exists(finalizeResult.error) && finalizeResult.error.length > 0) { + pendingPromise.reject(finalizeResult.error); + } else { + pendingPromise.resolve(); + } break; + } case TPM.TPM_RESET_TRACE_PROCESSOR: assertExists(this.pendingResetTraceProcessors.shift()).resolve(); break;