| OLD | NEW |
| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const ui::AXTreeUpdate&)>; | 103 const ui::AXTreeUpdate&)>; |
| 104 | 104 |
| 105 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 105 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
| 106 // respect to swap out. | 106 // respect to swap out. |
| 107 enum RenderFrameHostImplState { | 107 enum RenderFrameHostImplState { |
| 108 // The standard state for a RFH handling the communication with an active | 108 // The standard state for a RFH handling the communication with an active |
| 109 // RenderFrame. | 109 // RenderFrame. |
| 110 STATE_DEFAULT = 0, | 110 STATE_DEFAULT = 0, |
| 111 // The RFH has not received the SwapOutACK yet, but the new page has | 111 // The RFH has not received the SwapOutACK yet, but the new page has |
| 112 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH | 112 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH |
| 113 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are | 113 // will be deleted. |
| 114 // other active frames in its SiteInstance) or it will be deleted. | |
| 115 STATE_PENDING_SWAP_OUT, | 114 STATE_PENDING_SWAP_OUT, |
| 116 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being | |
| 117 // used as a placeholder to allow cross-process communication. Only main | |
| 118 // frames can enter this state. | |
| 119 STATE_SWAPPED_OUT, | |
| 120 }; | 115 }; |
| 121 // Helper function to determine whether the RFH state should contribute to the | 116 // Helper function to determine whether the RFH state should contribute to the |
| 122 // number of active frames of a SiteInstance or not. | 117 // number of active frames of a SiteInstance or not. |
| 123 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); | 118 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); |
| 124 | 119 |
| 125 // An accessibility reset is only allowed to prevent very rare corner cases | 120 // An accessibility reset is only allowed to prevent very rare corner cases |
| 126 // or race conditions where the browser and renderer get out of sync. If | 121 // or race conditions where the browser and renderer get out of sync. If |
| 127 // this happens more than this many times, kill the renderer. | 122 // this happens more than this many times, kill the renderer. |
| 128 static const int kMaxAccessibilityResets = 5; | 123 static const int kMaxAccessibilityResets = 5; |
| 129 | 124 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return is_waiting_for_beforeunload_ack_; | 348 return is_waiting_for_beforeunload_ack_; |
| 354 } | 349 } |
| 355 | 350 |
| 356 // Whether the RFH is waiting for an unload ACK from the renderer. | 351 // Whether the RFH is waiting for an unload ACK from the renderer. |
| 357 bool IsWaitingForUnloadACK() const; | 352 bool IsWaitingForUnloadACK() const; |
| 358 | 353 |
| 359 // Called when either the SwapOut request has been acknowledged or has timed | 354 // Called when either the SwapOut request has been acknowledged or has timed |
| 360 // out. | 355 // out. |
| 361 void OnSwappedOut(); | 356 void OnSwappedOut(); |
| 362 | 357 |
| 363 // Whether this RenderFrameHost has been swapped out, such that the frame is | |
| 364 // now rendered by a RenderFrameHost in a different process. | |
| 365 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; } | |
| 366 | |
| 367 // The current state of this RFH. | 358 // The current state of this RFH. |
| 368 RenderFrameHostImplState rfh_state() const { return rfh_state_; } | 359 RenderFrameHostImplState rfh_state() const { return rfh_state_; } |
| 369 | 360 |
| 370 // Sends the given navigation message. Use this rather than sending it | 361 // Sends the given navigation message. Use this rather than sending it |
| 371 // yourself since this does the internal bookkeeping described below. This | 362 // yourself since this does the internal bookkeeping described below. This |
| 372 // function takes ownership of the provided message pointer. | 363 // function takes ownership of the provided message pointer. |
| 373 // | 364 // |
| 374 // If a cross-site request is in progress, we may be suspended while waiting | 365 // If a cross-site request is in progress, we may be suspended while waiting |
| 375 // for the onbeforeunload handler, so this function might buffer the message | 366 // for the onbeforeunload handler, so this function might buffer the message |
| 376 // rather than sending it. | 367 // rather than sending it. |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 933 |
| 943 // NOTE: This must be the last member. | 934 // NOTE: This must be the last member. |
| 944 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 935 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 945 | 936 |
| 946 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 937 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 947 }; | 938 }; |
| 948 | 939 |
| 949 } // namespace content | 940 } // namespace content |
| 950 | 941 |
| 951 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 942 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |