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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 149142: Add a bunch of CHECKs to RenderViewHost trying to track down a crash. (Closed)
Patch Set: Created 11 years, 6 months 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 | « chrome/browser/renderer_host/render_view_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_view_host.cc
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 8072eb24e47aeae040961003b4b6f167aad695ae..a3f4314d2dc3ef8ed772af4934e6b908dae92b43 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -112,6 +112,12 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
modal_dialog_event = new base::WaitableEvent(true, false);
modal_dialog_event_.reset(modal_dialog_event);
+
+ // TODO(mpcomplete): remove this notification (and registrar) when we figure
+ // out why we're crashing on process()->Init().
+ // http://code.google.com/p/chromium/issues/detail?id=15607
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
+ NotificationService::AllSources());
}
RenderViewHost::~RenderViewHost() {
@@ -129,8 +135,32 @@ RenderViewHost::~RenderViewHost() {
NotificationService::NoDetails());
}
+void RenderViewHost::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
+ RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
+ if (rph == process()) {
+ // Try to get some debugging information on the stack.
+ size_t num_hosts = RenderProcessHost::size();
+ bool no_listeners = rph->listeners_begin() == rph->listeners_end();
+ bool live_instance = site_instance() != NULL;
+ CHECK(live_instance);
+ bool live_process = site_instance()->GetProcess() != NULL;
+ bool same_process = site_instance()->GetProcess() == rph;
+ CHECK(no_listeners);
+ CHECK(live_process);
+ CHECK(same_process);
+ CHECK(num_hosts > 0);
+ CHECK(false) << "RenderViewHost should outlive its RenderProcessHost.";
+ }
+}
+
bool RenderViewHost::CreateRenderView() {
DCHECK(!IsRenderViewLive()) << "Creating view twice";
+ CHECK(process());
+ CHECK(process()->listeners_begin() != process()->listeners_end()) <<
+ "Our process should have us as a listener.";
// The process may (if we're sharing a process with another host that already
// initialized it) or may not (we have our own process or the old process
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698