Skip to content

Commit

Permalink
Merge "ui: tp: plumb errors in NotifyEndOfFile into UI" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Nov 15, 2024
2 parents daeb5b9 + f295feb commit 6cdc068
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
8 changes: 7 additions & 1 deletion protos/perfetto/trace_processor/trace_processor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -356,4 +358,8 @@ message RegisterSqlPackageArgs {

message RegisterSqlPackageResult {
optional string error = 1;
}
}

message FinalizeDataResult {
optional string error = 1;
}
Binary file modified python/perfetto/trace_processor/trace_processor.descriptor
Binary file not shown.
6 changes: 5 additions & 1 deletion src/trace_processor/rpc/rpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 11 additions & 3 deletions ui/src/trace_processor/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 6cdc068

Please sign in to comment.