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

Side by Side 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: Created 5 years, 11 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
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // active RenderFrames, but not until WasSwappedOut is called. 245 // active RenderFrames, but not until WasSwappedOut is called.
246 void SwapOut(RenderFrameProxyHost* proxy, bool is_loading); 246 void SwapOut(RenderFrameProxyHost* proxy, bool is_loading);
247 247
248 bool is_waiting_for_beforeunload_ack() const { 248 bool is_waiting_for_beforeunload_ack() const {
249 return is_waiting_for_beforeunload_ack_; 249 return is_waiting_for_beforeunload_ack_;
250 } 250 }
251 251
252 // Whether the RFH is waiting for an unload ACK from the renderer. 252 // Whether the RFH is waiting for an unload ACK from the renderer.
253 bool IsWaitingForUnloadACK() const; 253 bool IsWaitingForUnloadACK() const;
254 254
255 // Whether sudden termination is allowed for this frame.
Charlie Reis 2015/01/23 06:01:32 Briefly mention what conditions determine this.
clamy 2015/01/26 16:38:40 Done.
256 bool SuddenTerminationAllowed() const;
257
258 // Called by the browser to override or not the sudden termination status of
Charlie Reis 2015/01/23 06:01:32 nit: (or not)
clamy 2015/01/26 16:38:39 Done.
259 // the frame. When overriden, sudden termination is always allowed, even if
260 // some disablers are present for the frame.
Charlie Reis 2015/01/23 06:01:32 "disablers" isn't a well-defined term in the code.
clamy 2015/01/26 16:38:39 Done.
261 void set_override_sudden_termination_status(bool enabled) {
262 override_sudden_termination_status_ = enabled;
263 }
264
255 // Called when either the SwapOut request has been acknowledged or has timed 265 // Called when either the SwapOut request has been acknowledged or has timed
256 // out. 266 // out.
257 void OnSwappedOut(); 267 void OnSwappedOut();
258 268
259 // Whether this RenderFrameHost has been swapped out, such that the frame is 269 // Whether this RenderFrameHost has been swapped out, such that the frame is
260 // now rendered by a RenderFrameHost in a different process. 270 // now rendered by a RenderFrameHost in a different process.
261 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; } 271 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; }
262 272
263 // The current state of this RFH. 273 // The current state of this RFH.
264 RenderFrameHostImplState rfh_state() const { return rfh_state_; } 274 RenderFrameHostImplState rfh_state() const { return rfh_state_; }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params, 471 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params,
462 const CommonNavigationParams& common_params); 472 const CommonNavigationParams& common_params);
463 void OnAccessibilityEvents( 473 void OnAccessibilityEvents(
464 const std::vector<AccessibilityHostMsg_EventParams>& params, 474 const std::vector<AccessibilityHostMsg_EventParams>& params,
465 int reset_token); 475 int reset_token);
466 void OnAccessibilityLocationChanges( 476 void OnAccessibilityLocationChanges(
467 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); 477 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
468 void OnAccessibilityFindInPageResult( 478 void OnAccessibilityFindInPageResult(
469 const AccessibilityHostMsg_FindInPageResultParams& params); 479 const AccessibilityHostMsg_FindInPageResultParams& params);
470 void OnToggleFullscreen(bool enter_fullscreen); 480 void OnToggleFullscreen(bool enter_fullscreen);
481 void OnBeforeUnloadHandlersPresenceChanged(bool present);
482 void OnUnloadHandlersPresenceChanged(bool present);
Charlie Reis 2015/01/23 06:01:32 These names are a bit unwieldy. Would On{Before}U
clamy 2015/01/26 16:38:40 Done.
471 483
472 #if defined(OS_MACOSX) || defined(OS_ANDROID) 484 #if defined(OS_MACOSX) || defined(OS_ANDROID)
473 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); 485 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
474 void OnHidePopup(); 486 void OnHidePopup();
475 #endif 487 #endif
476 488
477 // Registers Mojo services that this frame host makes available. 489 // Registers Mojo services that this frame host makes available.
478 void RegisterMojoServices(); 490 void RegisterMojoServices();
479 491
480 // Updates the state of this RenderFrameHost and clears any waiting state 492 // Updates the state of this RenderFrameHost and clears any waiting state
(...skipping 18 matching lines...) Expand all
499 const std::map<int32, int>& node_to_browser_plugin_instance_id_map); 511 const std::map<int32, int>& node_to_browser_plugin_instance_id_map);
500 512
501 // Asserts that the given RenderFrameHostImpl is part of the same browser 513 // Asserts that the given RenderFrameHostImpl is part of the same browser
502 // context (and crashes if not), then returns whether the given frame is 514 // context (and crashes if not), then returns whether the given frame is
503 // part of the same site instance. 515 // part of the same site instance.
504 bool IsSameSiteInstance(RenderFrameHostImpl* other_render_frame_host); 516 bool IsSameSiteInstance(RenderFrameHostImpl* other_render_frame_host);
505 517
506 // Informs the content client that geolocation permissions were used. 518 // Informs the content client that geolocation permissions were used.
507 void DidUseGeolocationPermission(); 519 void DidUseGeolocationPermission();
508 520
521 // Handle a change in presence for one of the sudden termination disablers.
522 // Signals the RenderProcessHost if the sudden termination status for this
523 // frame changes.
524 void HandleSuddenTerminationDisablerPresenceChange(bool* disabler_presence,
525 bool new_value);
526
509 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a 527 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a
510 // refcount that calls Shutdown when it reaches zero. This allows each 528 // refcount that calls Shutdown when it reaches zero. This allows each
511 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring 529 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring
512 // we have a RenderViewHost for each RenderFrameHost. 530 // we have a RenderViewHost for each RenderFrameHost.
513 // TODO(creis): RenderViewHost will eventually go away and be replaced with 531 // TODO(creis): RenderViewHost will eventually go away and be replaced with
514 // some form of page context. 532 // some form of page context.
515 RenderViewHostImpl* render_view_host_; 533 RenderViewHostImpl* render_view_host_;
516 534
517 RenderFrameHostDelegate* delegate_; 535 RenderFrameHostDelegate* delegate_;
518 536
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // already exists it will still be used. 636 // already exists it will still be used.
619 bool no_create_browser_accessibility_manager_for_testing_; 637 bool no_create_browser_accessibility_manager_for_testing_;
620 638
621 // PlzNavigate: Owns the stream used in navigations to store the body of the 639 // PlzNavigate: Owns the stream used in navigations to store the body of the
622 // response once it has started. 640 // response once it has started.
623 scoped_ptr<StreamHandle> stream_handle_; 641 scoped_ptr<StreamHandle> stream_handle_;
624 642
625 // Context shared for each PermissionService instance created for this RFH. 643 // Context shared for each PermissionService instance created for this RFH.
626 scoped_ptr<PermissionServiceContext> permission_service_context_; 644 scoped_ptr<PermissionServiceContext> permission_service_context_;
627 645
646 // Used to track whether sudden termination is allowed for this frame.
647 // has_beforeunload_handlers_ and has_unload_handlers_ are also used to skip
648 // waiting for the execution of BeforeUnload and Unload if they are false. The
Charlie Reis 2015/01/23 06:01:32 ...to avoid asking the renderer process to run Bef
clamy 2015/01/26 16:38:39 Done.
649 // browser can set override_sudden_termination_status_ to true, in which case
650 // sudden termination will be allowed. This is used when a renderer executing
651 // BeforeUnload or Unload is unresponsive. All other values are modified based
652 // on IPCs received from the renderer.
653 bool has_beforeunload_handlers_;
Charlie Reis 2015/01/23 06:01:32 nit: Please put these near the other *unload membe
clamy 2015/01/26 16:38:40 Done.
654 bool has_unload_handlers_;
655 bool override_sudden_termination_status_;
656
628 // NOTE: This must be the last member. 657 // NOTE: This must be the last member.
629 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 658 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
630 659
631 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 660 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
632 }; 661 };
633 662
634 } // namespace content 663 } // namespace content
635 664
636 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 665 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698