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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 1014623002: Revert "Refactor sudden termination" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + fixed compilation error Created 5 years, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 // Whether an ongoing navigation is waiting for a BeforeUnload ACK from the 289 // Whether an ongoing navigation is waiting for a BeforeUnload ACK from the
290 // RenderFrame. Currently this only happens in cross-site navigations. 290 // RenderFrame. Currently this only happens in cross-site navigations.
291 // PlzNavigate: this happens in every browser-initiated navigation that is not 291 // PlzNavigate: this happens in every browser-initiated navigation that is not
292 // same-page. 292 // same-page.
293 bool IsWaitingForBeforeUnloadACK() const; 293 bool IsWaitingForBeforeUnloadACK() const;
294 294
295 // Whether the RFH is waiting for an unload ACK from the renderer. 295 // Whether the RFH is waiting for an unload ACK from the renderer.
296 bool IsWaitingForUnloadACK() const; 296 bool IsWaitingForUnloadACK() const;
297 297
298 // Whether sudden termination is allowed for this frame. This is true if there
299 // are no BeforeUnload handlers or no Unload handlers registered for the
300 // frame, or it was overriden by the browser to be always true.
301 bool SuddenTerminationAllowed() const;
302
303 // Called by the browser to override (or not) the sudden termination status of
304 // the frame. When overriden, sudden termination is always allowed, even if
305 // it would otherwise be prevented.
306 void set_override_sudden_termination_status(bool enabled) {
307 override_sudden_termination_status_ = enabled;
308 }
309
310 // Called when either the SwapOut request has been acknowledged or has timed 298 // Called when either the SwapOut request has been acknowledged or has timed
311 // out. 299 // out.
312 void OnSwappedOut(); 300 void OnSwappedOut();
313 301
314 // Whether this RenderFrameHost has been swapped out, such that the frame is 302 // Whether this RenderFrameHost has been swapped out, such that the frame is
315 // now rendered by a RenderFrameHost in a different process. 303 // now rendered by a RenderFrameHost in a different process.
316 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; } 304 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; }
317 305
318 // The current state of this RFH. 306 // The current state of this RFH.
319 RenderFrameHostImplState rfh_state() const { return rfh_state_; } 307 RenderFrameHostImplState rfh_state() const { return rfh_state_; }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 scoped_refptr<ResourceRequestBody> body); 520 scoped_refptr<ResourceRequestBody> body);
533 void OnDispatchLoad(); 521 void OnDispatchLoad();
534 void OnAccessibilityEvents( 522 void OnAccessibilityEvents(
535 const std::vector<AccessibilityHostMsg_EventParams>& params, 523 const std::vector<AccessibilityHostMsg_EventParams>& params,
536 int reset_token); 524 int reset_token);
537 void OnAccessibilityLocationChanges( 525 void OnAccessibilityLocationChanges(
538 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 526 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
539 void OnAccessibilityFindInPageResult( 527 void OnAccessibilityFindInPageResult(
540 const AccessibilityHostMsg_FindInPageResultParams& params); 528 const AccessibilityHostMsg_FindInPageResultParams& params);
541 void OnToggleFullscreen(bool enter_fullscreen); 529 void OnToggleFullscreen(bool enter_fullscreen);
542 void OnBeforeUnloadHandlersPresent(bool present);
543 void OnUnloadHandlersPresent(bool present);
544 530
545 #if defined(OS_MACOSX) || defined(OS_ANDROID) 531 #if defined(OS_MACOSX) || defined(OS_ANDROID)
546 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 532 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
547 void OnHidePopup(); 533 void OnHidePopup();
548 #endif 534 #endif
549 535
550 // Registers Mojo services that this frame host makes available. 536 // Registers Mojo services that this frame host makes available.
551 void RegisterMojoServices(); 537 void RegisterMojoServices();
552 538
553 // Updates the state of this RenderFrameHost and clears any waiting state 539 // Updates the state of this RenderFrameHost and clears any waiting state
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // this RFH is the pending RenderFrameHost of a RenderFrameHostManager. There 645 // this RFH is the pending RenderFrameHost of a RenderFrameHostManager. There
660 // will only ever be one suspended navigation, because RenderFrameHostManager 646 // will only ever be one suspended navigation, because RenderFrameHostManager
661 // will destroy the pending RenderFrameHost and create a new one if a second 647 // will destroy the pending RenderFrameHost and create a new one if a second
662 // navigation occurs. 648 // navigation occurs.
663 // PlzNavigate: unused as navigations are never suspended. 649 // PlzNavigate: unused as navigations are never suspended.
664 scoped_ptr<NavigationParams> suspended_nav_params_; 650 scoped_ptr<NavigationParams> suspended_nav_params_;
665 651
666 // When the last BeforeUnload message was sent. 652 // When the last BeforeUnload message was sent.
667 base::TimeTicks send_before_unload_start_time_; 653 base::TimeTicks send_before_unload_start_time_;
668 654
669 // Used to track whether sudden termination is allowed for this frame.
670 // has_beforeunload_handlers_ and has_unload_handlers_ are also used to avoid
671 // asking the renderer process to run BeforeUnload or Unload during
672 // navigation. The browser can set override_sudden_termination_status_ to
673 // true, in which case sudden termination will be allowed. This is used when a
674 // renderer executing BeforeUnload or Unload is unresponsive. All other values
675 // are modified based on IPCs received from the renderer.
676 bool has_beforeunload_handlers_;
677 bool has_unload_handlers_;
678 bool override_sudden_termination_status_;
679
680 // Set to true when there is a pending FrameMsg_ShouldClose message. This 655 // Set to true when there is a pending FrameMsg_ShouldClose message. This
681 // ensures we don't spam the renderer with multiple beforeunload requests. 656 // ensures we don't spam the renderer with multiple beforeunload requests.
682 // When either this value or IsWaitingForUnloadACK is true, the value of 657 // When either this value or IsWaitingForUnloadACK is true, the value of
683 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a 658 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a
684 // cross-site transition or a tab close attempt. 659 // cross-site transition or a tab close attempt.
685 // TODO(clamy): Remove this boolean and add one more state to the state 660 // TODO(clamy): Remove this boolean and add one more state to the state
686 // machine. 661 // machine.
687 bool is_waiting_for_beforeunload_ack_; 662 bool is_waiting_for_beforeunload_ack_;
688 663
689 // Valid only when is_waiting_for_beforeunload_ack_ or 664 // Valid only when is_waiting_for_beforeunload_ack_ or
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 716
742 // NOTE: This must be the last member. 717 // NOTE: This must be the last member.
743 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 718 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
744 719
745 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 720 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
746 }; 721 };
747 722
748 } // namespace content 723 } // namespace content
749 724
750 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 725 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW
« 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