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

Unified Diff: content/renderer/render_widget.cc

Issue 464593003: Don't swap out the old RenderFrameHost until the new one commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase past PlzNavigate CL Created 6 years, 4 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 | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 10d87e16fe98629050057dce80ae3b6bc182a69d..31e10e3e915199b28483daaeb99630f1a56227ca 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -512,13 +512,20 @@ void RenderWidget::SetSwappedOut(bool is_swapped_out) {
// If we are swapping out, we will call ReleaseProcess, allowing the process
// to exit if all of its RenderViews are swapped out. We wait until the
- // WasSwappedOut call to do this, to avoid showing the sad tab.
+ // WasSwappedOut call to do this, to allow the unload handler to finish.
// If we are swapping in, we call AddRefProcess to prevent the process from
// exiting.
- if (!is_swapped_out)
+ if (!is_swapped_out_)
RenderProcess::current()->AddRefProcess();
}
+void RenderWidget::WasSwappedOut() {
+ // If we have been swapped out and no one else is using this process,
+ // it's safe to exit now.
+ CHECK(is_swapped_out_);
+ RenderProcess::current()->ReleaseProcess();
+}
+
void RenderWidget::EnableScreenMetricsEmulation(
const WebDeviceEmulationParams& params) {
if (!screen_metrics_emulator_)
@@ -598,7 +605,6 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_ChangeResizeRect, OnChangeResizeRect)
IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden)
IPC_MESSAGE_HANDLER(ViewMsg_WasShown, OnWasShown)
- IPC_MESSAGE_HANDLER(ViewMsg_WasSwappedOut, OnWasSwappedOut)
IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive)
IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowShown, OnCandidateWindowShown)
IPC_MESSAGE_HANDLER(ViewMsg_CandidateWindowUpdated,
@@ -804,14 +810,6 @@ void RenderWidget::OnWasShown(bool needs_repainting,
scheduleComposite();
}
-void RenderWidget::OnWasSwappedOut() {
- // If we have been swapped out and no one else is using this process,
- // it's safe to exit now. If we get swapped back in, we will call
- // AddRefProcess in SetSwappedOut.
- if (is_swapped_out_)
- RenderProcess::current()->ReleaseProcess();
-}
-
void RenderWidget::OnRequestMoveAck() {
DCHECK(pending_window_rect_count_);
pending_window_rect_count_--;
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698