Cleanup power save blockers after a RenderView crashes.
Looks like RenderFrameDeleted() wasn't called if a RenderView
crashes, which results in the WebContents having some lingering
power save blockers and media player entries.
BUG=455943
TEST=new unittest. DCHECK() no longer fires.
Review URL: https://codereview.chromium.org/886603009
Cr-Commit-Position: refs/heads/master@{#314934}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 4c80e1f1..05b5a81 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3663,6 +3663,10 @@
void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh,
base::TerminationStatus status,
int error_code) {
+ // TODO(nasko): This isn't ideal; the termination process should be handled by
+ // RenderFrameDeleted(). See http://crbug.com/455943.
+ ClearPowerSaveBlockers(rvh->GetMainFrame());
+
if (rvh != GetRenderViewHost()) {
// The pending page's RenderViewHost is gone.
return;