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

Unified Diff: headless/app/headless_shell.cc

Issue 2514343002: Don't silently eat Inspector.TargetCrashed (Closed)
Patch Set: Added a comment 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
« no previous file with comments | « no previous file | headless/lib/browser/headless_devtools_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/app/headless_shell.cc
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc
index 6f291a6cd6b9f8a71cc852e80644bcd69aec76a3..8fc623abf91cd12c407398d651476430973552a6 100644
--- a/headless/app/headless_shell.cc
+++ b/headless/app/headless_shell.cc
@@ -19,6 +19,7 @@
#include "content/public/common/content_switches.h"
#include "headless/app/headless_shell_switches.h"
#include "headless/public/devtools/domains/emulation.h"
+#include "headless/public/devtools/domains/inspector.h"
#include "headless/public/devtools/domains/page.h"
#include "headless/public/devtools/domains/runtime.h"
#include "headless/public/headless_browser.h"
@@ -55,6 +56,7 @@ bool ParseWindowSize(std::string window_size, gfx::Size* parsed_window_size) {
// An application which implements a simple headless browser.
class HeadlessShell : public HeadlessWebContents::Observer,
emulation::ExperimentalObserver,
+ inspector::ExperimentalObserver,
page::Observer {
public:
HeadlessShell()
@@ -118,6 +120,7 @@ class HeadlessShell : public HeadlessWebContents::Observer,
return;
if (!RemoteDebuggingEnabled()) {
devtools_client_->GetEmulation()->GetExperimental()->RemoveObserver(this);
+ devtools_client_->GetInspector()->GetExperimental()->RemoveObserver(this);
devtools_client_->GetPage()->RemoveObserver(this);
if (web_contents_->GetDevToolsTarget()) {
web_contents_->GetDevToolsTarget()->DetachClient(
@@ -135,6 +138,7 @@ class HeadlessShell : public HeadlessWebContents::Observer,
if (RemoteDebuggingEnabled())
return;
web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get());
+ devtools_client_->GetInspector()->GetExperimental()->AddObserver(this);
devtools_client_->GetPage()->AddObserver(this);
devtools_client_->GetPage()->Enable();
// Check if the document had already finished loading by the time we
@@ -162,12 +166,9 @@ 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;
-
+ void OnTargetCrashed(const inspector::TargetCrashedParams& params) override {
LOG(ERROR) << "Abnormal renderer termination.";
+ // NB this never gets called if remote debugging is enabled.
Shutdown();
}
« no previous file with comments | « no previous file | headless/lib/browser/headless_devtools_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698