feat: add error event for utility process (33-x-y) (#43997)
* 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>
* fixup! feat: add error event for utility process (#43774)
remove #include "electron/mas.h"
this header did not exist before c1c8fbfd9
---------
Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
d8cd86c4fa
commit
5836ea1a78
16 changed files with 166 additions and 5 deletions
|
@ -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) {
|
||||
|
|
|
@ -44,6 +44,7 @@ class UtilityProcessWrapper final
|
|||
public gin_helper::Pinnable<UtilityProcessWrapper>,
|
||||
public gin_helper::EventEmitterMixin<UtilityProcessWrapper>,
|
||||
public mojo::MessageReceiver,
|
||||
public node::mojom::NodeServiceClient,
|
||||
public content::ServiceProcessHost::Observer {
|
||||
public:
|
||||
enum class IOHandle : size_t { STDIN = 0, STDOUT = 1, STDERR = 2 };
|
||||
|
@ -81,6 +82,10 @@ class UtilityProcessWrapper final
|
|||
// mojo::MessageReceiver
|
||||
bool Accept(mojo::Message* mojo_message) override;
|
||||
|
||||
// node::mojom::NodeServiceClient
|
||||
void OnV8FatalError(const std::string& location,
|
||||
const std::string& report) override;
|
||||
|
||||
// content::ServiceProcessHost::Observer
|
||||
void OnServiceProcessTerminatedNormally(
|
||||
const content::ServiceProcessInfo& info) override;
|
||||
|
@ -102,6 +107,7 @@ class UtilityProcessWrapper final
|
|||
bool connector_closed_ = false;
|
||||
std::unique_ptr<mojo::Connector> connector_;
|
||||
blink::MessagePortDescriptor host_port_;
|
||||
mojo::Receiver<node::mojom::NodeServiceClient> receiver_{this};
|
||||
mojo::Remote<node::mojom::NodeService> node_service_remote_;
|
||||
std::optional<electron::URLLoaderNetworkObserver>
|
||||
url_loader_network_observer_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue