Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: headless/app/headless_shell.cc

Issue 2509813006: HeadlessWebContents:Observer to observe render process exit status (Closed)
Patch Set: Make it safe to call Shutdown() Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: headless/app/headless_shell.cc
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc
index b57fc5f9070de1e36aa9bfb743c76945ef53ca64..6f291a6cd6b9f8a71cc852e80644bcd69aec76a3 100644
--- a/headless/app/headless_shell.cc
+++ b/headless/app/headless_shell.cc
@@ -119,7 +119,10 @@ class HeadlessShell : public HeadlessWebContents::Observer,
if (!RemoteDebuggingEnabled()) {
devtools_client_->GetEmulation()->GetExperimental()->RemoveObserver(this);
devtools_client_->GetPage()->RemoveObserver(this);
- web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get());
+ if (web_contents_->GetDevToolsTarget()) {
+ web_contents_->GetDevToolsTarget()->DetachClient(
+ devtools_client_.get());
+ }
}
web_contents_->RemoveObserver(this);
web_contents_ = nullptr;
@@ -159,6 +162,15 @@ class HeadlessShell : public HeadlessWebContents::Observer,
// TODO(skyostil): Implement more features to demonstrate the devtools API.
}
+ void RenderProcessExited(base::TerminationStatus status,
+ int exit_code) override {
+ if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION)
+ return;
+
+ LOG(ERROR) << "Abnormal renderer termination.";
+ Shutdown();
+ }
+
void PollReadyState() {
// We need to check the current location in addition to the ready state to
// be sure the expected page is ready.

Powered by Google App Engine
This is Rietveld 408576698