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 |