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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 894843003: Move the RenderProcessGone IPC from RenderViewHost to RenderFrameHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for swapped out RFHs. Created 5 years, 10 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
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index e47c2a8e0977ab19b4201cd42215d7b6aa50bf0f..7656df12b4d8929dbc4019832911d3d520ae5789 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -10,6 +10,7 @@
#include "base/lazy_instance.h"
#include "base/metrics/histogram.h"
#include "base/metrics/user_metrics_action.h"
+#include "base/process/kill.h"
#include "base/time/time.h"
#include "content/browser/accessibility/accessibility_mode_helper.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
@@ -373,6 +374,9 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(AccessibilityHostMsg_FindInPageResult,
OnAccessibilityFindInPageResult)
IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen)
+ // The following message is synthetic and doesn't come from RenderFrame, but
+ // from RenderProcessHost.
+ IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
#if defined(OS_MACOSX) || defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
@@ -1019,6 +1023,38 @@ void RenderFrameHostImpl::OnSwapOutACK() {
OnSwappedOut();
}
+void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) {
+ return;
+
+ if (frame_tree_node_->IsMainFrame()) {
+ // Keep the termination status so we can get at it later when we
+ // need to know why it died.
+ render_view_host_->render_view_termination_status_ =
+ static_cast<base::TerminationStatus>(status);
+ }
+
+ SetRenderFrameCreated(false);
+ InvalidateMojoConnection();
+
+ // Reset frame tree state associated with this process. This must happen
+ // before RenderViewTerminated because observers expect the subframes of any
+ // affected frames to be cleared first.
+ // Note: Swapped out RenderFrameHost is owned by the RenderFrameProxyHost,
+ // therefore it doesn't need to reset FrameTreeNode state.
nasko 2015/02/05 23:08:45 I accidentally slipped a rebase in, so the intra-p
Charlie Reis 2015/02/06 00:04:48 I don't quite understand the comment. Why does "o
nasko 2015/02/06 01:10:48 Done.
+ if (is_swapped_out())
Charlie Reis 2015/02/06 00:04:48 Isn't this backwards? This only resets it if it's
nasko 2015/02/06 01:10:48 Indeed it is, I had different check before so slip
+ frame_tree_node_->ResetForNewProcess();
+
+ if (frame_tree_node_->IsMainFrame()) {
+ // RenderViewHost/RenderWidgetHost needs to reset some stuff.
+ render_view_host_->RendererExited(
+ render_view_host_->render_view_termination_status_, exit_code);
+
+ render_view_host_->delegate_->RenderViewTerminated(
+ render_view_host_, static_cast<base::TerminationStatus>(status),
+ exit_code);
+ }
+}
+
void RenderFrameHostImpl::OnSwappedOut() {
// Ignore spurious swap out ack.
if (rfh_state_ != STATE_PENDING_SWAP_OUT)

Powered by Google App Engine
This is Rietveld 408576698