Chromium Code Reviews| 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 e9649758eed0a210b94fe3583e3a8e901f5476be..8dbc3313b139852d03490d0fe68d966b7a55b721 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.h |
| +++ b/content/browser/frame_host/render_frame_host_impl.h |
| @@ -265,6 +265,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 |
| + // would otherwise be prevented. |
|
Charlie Reis
2015/01/29 23:20:41
nit: it would
clamy
2015/02/02 16:16:27
Done.
|
| + 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(); |
| @@ -482,6 +494,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); |
| @@ -520,6 +534,12 @@ class CONTENT_EXPORT RenderFrameHostImpl |
| // Informs the content client that geolocation permissions were used. |
| void DidUseGeolocationPermission(); |
| + // Handle a change in presence for one of the sudden termination disablers. |
| + // Signals the RenderProcessHost if the sudden termination status for this |
| + // frame changes. |
| + void HandleSuddenTerminationDisablerPresenceChange(bool* disabler_presence, |
|
Charlie Reis
2015/01/29 23:20:41
Don't forget to remove this, now that the implemen
clamy
2015/02/02 16:16:27
Done.
|
| + bool new_value); |
| + |
| // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
| // refcount that calls Shutdown when it reaches zero. This allows each |
| // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
| @@ -594,6 +614,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 |