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

Unified Diff: content/renderer/render_widget.cc

Issue 2410153005: Fix RenderView reuse issues when canceling a pending RenderFrameHost. (Closed)
Patch Set: Rebase Created 4 years, 2 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 060e15d0c0e4e4c1841bb08a4bdf340aea0b212f..bad734174607b0d80a9a349333307adfaea34849 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -385,6 +385,20 @@ void RenderWidget::SetRoutingID(int32_t routing_id) {
GetRenderWidgetInputHandlerDelegate(this), this));
}
+void RenderWidget::SetSwappedOut(bool is_swapped_out) {
+ // We should only toggle between states.
+ DCHECK(is_swapped_out_ != is_swapped_out);
+ is_swapped_out_ = 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 allow the unload handler to finish.
+ // If we are swapping in, we call AddRefProcess to prevent the process from
+ // exiting.
+ if (!is_swapped_out_)
+ RenderProcess::current()->AddRefProcess();
+}
+
bool RenderWidget::Init(int32_t opener_id) {
bool success = DoInit(
opener_id, RenderWidget::CreateWebWidget(this),
@@ -431,20 +445,6 @@ bool RenderWidget::DoInit(int32_t opener_id,
}
}
-void RenderWidget::SetSwappedOut(bool is_swapped_out) {
- // We should only toggle between states.
- DCHECK(is_swapped_out_ != is_swapped_out);
- is_swapped_out_ = 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 allow the unload handler to finish.
- // If we are swapping in, we call AddRefProcess to prevent the process from
- // exiting.
- 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.
« 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