feat: add error event for utility process (#43774)

* feat: add error event for utility process

* chore: use public report api

* chore: fix lint

* doc: mark error event as experimental

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
Robo 2024-09-27 10:17:06 +09:00 committed by GitHub
parent 8397fef3ef
commit f68184a9f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 167 additions and 5 deletions

View file

@ -223,7 +223,8 @@ UtilityProcessWrapper::UtilityProcessWrapper(
params->use_network_observer_from_url_loader_factory =
create_network_observer;
node_service_remote_->Initialize(std::move(params));
node_service_remote_->Initialize(std::move(params),
receiver_.BindNewPipeAndPassRemote());
}
UtilityProcessWrapper::~UtilityProcessWrapper() {
@ -258,8 +259,9 @@ void UtilityProcessWrapper::HandleTermination(uint64_t exit_code) {
void UtilityProcessWrapper::OnServiceProcessDisconnected(
uint32_t exit_code,
const std::string& description) {
if (description == "process_exit_termination")
if (description == "process_exit_termination") {
HandleTermination(exit_code);
}
}
void UtilityProcessWrapper::OnServiceProcessTerminatedNormally(
@ -372,6 +374,11 @@ bool UtilityProcessWrapper::Accept(mojo::Message* mojo_message) {
return true;
}
void UtilityProcessWrapper::OnV8FatalError(const std::string& location,
const std::string& report) {
EmitWithoutEvent("error", "FatalError", location, report);
}
// static
raw_ptr<UtilityProcessWrapper> UtilityProcessWrapper::FromProcessId(
base::ProcessId pid) {