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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 class StreamHandle; | 84 class StreamHandle; |
85 class TimeoutMonitor; | 85 class TimeoutMonitor; |
86 struct ContextMenuParams; | 86 struct ContextMenuParams; |
87 struct GlobalRequestID; | 87 struct GlobalRequestID; |
88 struct Referrer; | 88 struct Referrer; |
89 struct ResourceResponse; | 89 struct ResourceResponse; |
90 | 90 |
91 // Flag arguments for RenderFrameHost creation. | 91 // Flag arguments for RenderFrameHost creation. |
92 enum CreateRenderFrameFlags { | 92 enum CreateRenderFrameFlags { |
93 // The RFH will be initially placed on the swapped out hosts list. | 93 // The RFH will be initially placed on the swapped out hosts list. |
94 CREATE_RF_SWAPPED_OUT = 1 << 0, | 94 CREATE_RF_SWAPPED_OUT = 1 << 0, |
Charlie Reis
2016/03/14 20:12:57
This can be removed now, right? That would make t
nasko
2016/03/14 21:32:30
It is already done in a separate CL - https://code
| |
95 // The RenderFrame is initially hidden. | 95 // The RenderFrame is initially hidden. |
96 CREATE_RF_HIDDEN = 1 << 1, | 96 CREATE_RF_HIDDEN = 1 << 1, |
97 }; | 97 }; |
98 | 98 |
99 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, | 99 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, |
100 public BrowserAccessibilityDelegate, | 100 public BrowserAccessibilityDelegate, |
101 public SiteInstanceImpl::Observer { | 101 public SiteInstanceImpl::Observer { |
102 public: | 102 public: |
103 using AXTreeSnapshotCallback = | 103 using AXTreeSnapshotCallback = |
104 base::Callback<void( | 104 base::Callback<void( |
105 const ui::AXTreeUpdate&)>; | 105 const ui::AXTreeUpdate&)>; |
106 | 106 |
107 // Keeps track of the state of the RenderFrameHostImpl, particularly with | 107 // Keeps track of the state of the RenderFrameHostImpl, particularly with |
108 // respect to swap out. | 108 // respect to swap out. |
109 enum RenderFrameHostImplState { | 109 enum RenderFrameHostImplState { |
110 // The standard state for a RFH handling the communication with an active | 110 // The standard state for a RFH handling the communication with an active |
111 // RenderFrame. | 111 // RenderFrame. |
112 STATE_DEFAULT = 0, | 112 STATE_DEFAULT = 0, |
113 // The RFH has not received the SwapOutACK yet, but the new page has | 113 // The RFH has not received the SwapOutACK yet, but the new page has |
114 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH | 114 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH |
115 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are | 115 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are |
116 // other active frames in its SiteInstance) or it will be deleted. | 116 // other active frames in its SiteInstance) or it will be deleted. |
Charlie Reis
2016/03/14 20:12:57
Let's update this comment, too.
(Maybe sometime w
nasko
2016/03/14 21:32:30
Yeah, I'd convert this to boolean separately.
| |
117 STATE_PENDING_SWAP_OUT, | 117 STATE_PENDING_SWAP_OUT, |
118 // The RFH is swapped out and stored inside a RenderFrameProxyHost, being | |
119 // used as a placeholder to allow cross-process communication. Only main | |
120 // frames can enter this state. | |
121 STATE_SWAPPED_OUT, | |
122 }; | 118 }; |
123 // Helper function to determine whether the RFH state should contribute to the | 119 // Helper function to determine whether the RFH state should contribute to the |
124 // number of active frames of a SiteInstance or not. | 120 // number of active frames of a SiteInstance or not. |
125 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); | 121 static bool IsRFHStateActive(RenderFrameHostImplState rfh_state); |
126 | 122 |
127 // An accessibility reset is only allowed to prevent very rare corner cases | 123 // An accessibility reset is only allowed to prevent very rare corner cases |
128 // or race conditions where the browser and renderer get out of sync. If | 124 // or race conditions where the browser and renderer get out of sync. If |
129 // this happens more than this many times, kill the renderer. | 125 // this happens more than this many times, kill the renderer. |
130 static const int kMaxAccessibilityResets = 5; | 126 static const int kMaxAccessibilityResets = 5; |
131 | 127 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 return is_waiting_for_beforeunload_ack_; | 351 return is_waiting_for_beforeunload_ack_; |
356 } | 352 } |
357 | 353 |
358 // Whether the RFH is waiting for an unload ACK from the renderer. | 354 // Whether the RFH is waiting for an unload ACK from the renderer. |
359 bool IsWaitingForUnloadACK() const; | 355 bool IsWaitingForUnloadACK() const; |
360 | 356 |
361 // Called when either the SwapOut request has been acknowledged or has timed | 357 // Called when either the SwapOut request has been acknowledged or has timed |
362 // out. | 358 // out. |
363 void OnSwappedOut(); | 359 void OnSwappedOut(); |
364 | 360 |
365 // Whether this RenderFrameHost has been swapped out, such that the frame is | |
366 // now rendered by a RenderFrameHost in a different process. | |
367 bool is_swapped_out() const { return rfh_state_ == STATE_SWAPPED_OUT; } | |
368 | |
369 // The current state of this RFH. | 361 // The current state of this RFH. |
370 RenderFrameHostImplState rfh_state() const { return rfh_state_; } | 362 RenderFrameHostImplState rfh_state() const { return rfh_state_; } |
371 | 363 |
372 // Sends the given navigation message. Use this rather than sending it | 364 // Sends the given navigation message. Use this rather than sending it |
373 // yourself since this does the internal bookkeeping described below. This | 365 // yourself since this does the internal bookkeeping described below. This |
374 // function takes ownership of the provided message pointer. | 366 // function takes ownership of the provided message pointer. |
375 // | 367 // |
376 // If a cross-site request is in progress, we may be suspended while waiting | 368 // If a cross-site request is in progress, we may be suspended while waiting |
377 // for the onbeforeunload handler, so this function might buffer the message | 369 // for the onbeforeunload handler, so this function might buffer the message |
378 // rather than sending it. | 370 // rather than sending it. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 | 936 |
945 // NOTE: This must be the last member. | 937 // NOTE: This must be the last member. |
946 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 938 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
947 | 939 |
948 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 940 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
949 }; | 941 }; |
950 | 942 |
951 } // namespace content | 943 } // namespace content |
952 | 944 |
953 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 945 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |