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

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

Issue 857213003: Refactor sudden termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_impl.h
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index c382859398597cc177fea6e041330f2b89bd0189..595ebc39f62ac6b3c898152eaff245ae883231ee 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -270,6 +270,18 @@ class CONTENT_EXPORT RenderFrameHostImpl
// Whether the RFH is waiting for an unload ACK from the renderer.
bool IsWaitingForUnloadACK() const;
+ // Whether sudden termination is allowed for this frame. This is true if there
+ // are no BeforeUnload handlers or no Unload handlers registered for the
+ // frame, or it was overriden by the browser to be always true.
+ bool SuddenTerminationAllowed() const;
+
+ // Called by the browser to override (or not) the sudden termination status of
+ // the frame. When overriden, sudden termination is always allowed, even if
+ // it would otherwise be prevented.
+ void set_override_sudden_termination_status(bool enabled) {
+ override_sudden_termination_status_ = enabled;
+ }
+
// Called when either the SwapOut request has been acknowledged or has timed
// out.
void OnSwappedOut();
@@ -496,6 +508,8 @@ class CONTENT_EXPORT RenderFrameHostImpl
void OnAccessibilityFindInPageResult(
const AccessibilityHostMsg_FindInPageResultParams& params);
void OnToggleFullscreen(bool enter_fullscreen);
+ void OnBeforeUnloadHandlersPresent(bool present);
+ void OnUnloadHandlersPresent(bool present);
#if defined(OS_MACOSX) || defined(OS_ANDROID)
void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
@@ -621,6 +635,17 @@ class CONTENT_EXPORT RenderFrameHostImpl
// When the last BeforeUnload message was sent.
base::TimeTicks send_before_unload_start_time_;
+ // Used to track whether sudden termination is allowed for this frame.
+ // has_beforeunload_handlers_ and has_unload_handlers_ are also used to avoid
+ // asking the renderer process to run BeforeUnload or Unload during
+ // navigation. The browser can set override_sudden_termination_status_ to
+ // true, in which case sudden termination will be allowed. This is used when a
+ // renderer executing BeforeUnload or Unload is unresponsive. All other values
+ // are modified based on IPCs received from the renderer.
+ bool has_beforeunload_handlers_;
+ bool has_unload_handlers_;
+ bool override_sudden_termination_status_;
+
// Set to true when there is a pending FrameMsg_ShouldClose message. This
// ensures we don't spam the renderer with multiple beforeunload requests.
// When either this value or IsWaitingForUnloadACK is true, the value of
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698