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_FRAME_TREE_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void ReplicatePageFocus(bool is_focused); | 204 void ReplicatePageFocus(bool is_focused); |
205 | 205 |
206 // Updates page-level focus for this FrameTree in the subframe renderer | 206 // Updates page-level focus for this FrameTree in the subframe renderer |
207 // identified by |instance|. | 207 // identified by |instance|. |
208 void SetPageFocus(SiteInstance* instance, bool is_focused); | 208 void SetPageFocus(SiteInstance* instance, bool is_focused); |
209 | 209 |
210 private: | 210 private: |
211 friend class FrameTreeTest; | 211 friend class FrameTreeTest; |
212 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, RemoveFocusedFrame); | 212 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, RemoveFocusedFrame); |
213 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; | 213 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; |
214 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; | |
215 | 214 |
216 // Returns a range to iterate over all FrameTreeNodes in the frame tree in | 215 // Returns a range to iterate over all FrameTreeNodes in the frame tree in |
217 // breadth-first traversal order, skipping the subtree rooted at | 216 // breadth-first traversal order, skipping the subtree rooted at |
218 // |node_to_skip|. | 217 // |node_to_skip|. |
219 NodeRange NodesExcept(FrameTreeNode* node_to_skip); | 218 NodeRange NodesExcept(FrameTreeNode* node_to_skip); |
220 | 219 |
221 // These delegates are installed into all the RenderViewHosts and | 220 // These delegates are installed into all the RenderViewHosts and |
222 // RenderFrameHosts that we create. | 221 // RenderFrameHosts that we create. |
223 RenderFrameHostDelegate* render_frame_delegate_; | 222 RenderFrameHostDelegate* render_frame_delegate_; |
224 RenderViewHostDelegate* render_view_delegate_; | 223 RenderViewHostDelegate* render_view_delegate_; |
225 RenderWidgetHostDelegate* render_widget_delegate_; | 224 RenderWidgetHostDelegate* render_widget_delegate_; |
226 RenderFrameHostManager::Delegate* manager_delegate_; | 225 RenderFrameHostManager::Delegate* manager_delegate_; |
227 | 226 |
228 // Map of SiteInstance ID to a RenderViewHost. This allows us to look up the | 227 // Map of SiteInstance ID to a RenderViewHost. This allows us to look up the |
229 // RenderViewHost for a given SiteInstance when creating RenderFrameHosts. | 228 // RenderViewHost for a given SiteInstance when creating RenderFrameHosts. |
230 // Combined with the refcount on RenderViewHost, this allows us to call | 229 // Combined with the refcount on RenderViewHost, this allows us to call |
231 // Shutdown on the RenderViewHost and remove it from the map when no more | 230 // Shutdown on the RenderViewHost and remove it from the map when no more |
232 // RenderFrameHosts are using it. | 231 // RenderFrameHosts are using it. |
233 // | 232 // |
234 // Must be declared before |root_| so that it is deleted afterward. Otherwise | 233 // Must be declared before |root_| so that it is deleted afterward. Otherwise |
235 // the map will be cleared before we delete the RenderFrameHosts in the tree. | 234 // the map will be cleared before we delete the RenderFrameHosts in the tree. |
236 RenderViewHostMap render_view_host_map_; | 235 RenderViewHostMap render_view_host_map_; |
237 | 236 |
238 // Map of SiteInstance ID to RenderViewHosts that are pending shutdown. The | |
239 // renderers of these RVH are currently executing the unload event in | |
240 // background. When the SwapOutACK is received, they will be deleted. In the | |
241 // meantime, they are kept in this map, as they should not be reused (part of | |
242 // their state is already gone away). | |
243 RenderViewHostMultiMap render_view_host_pending_shutdown_map_; | |
244 | |
245 // This is an owned ptr to the root FrameTreeNode, which never changes over | 237 // This is an owned ptr to the root FrameTreeNode, which never changes over |
246 // the lifetime of the FrameTree. It is not a scoped_ptr because we need the | 238 // the lifetime of the FrameTree. It is not a scoped_ptr because we need the |
247 // pointer to remain valid even while the FrameTreeNode is being destroyed, | 239 // pointer to remain valid even while the FrameTreeNode is being destroyed, |
248 // since it's common for a node to test whether it's the root node. | 240 // since it's common for a node to test whether it's the root node. |
249 FrameTreeNode* root_; | 241 FrameTreeNode* root_; |
250 | 242 |
251 int focused_frame_tree_node_id_; | 243 int focused_frame_tree_node_id_; |
252 | 244 |
253 base::Callback<void(RenderFrameHost*)> on_frame_removed_; | 245 base::Callback<void(RenderFrameHost*)> on_frame_removed_; |
254 | 246 |
255 // Overall load progress. | 247 // Overall load progress. |
256 double load_progress_; | 248 double load_progress_; |
257 | 249 |
258 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 250 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
259 }; | 251 }; |
260 | 252 |
261 } // namespace content | 253 } // namespace content |
262 | 254 |
263 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 255 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |