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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // the number drops to zero, we call Shutdown on the RenderViewHost. | 123 // the number drops to zero, we call Shutdown on the RenderViewHost. |
124 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 124 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
125 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 125 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
126 | 126 |
127 // Returns the FrameTreeNode with the given renderer-specific |frame_id|. | 127 // Returns the FrameTreeNode with the given renderer-specific |frame_id|. |
128 // TODO(creis): Make this private and replace this with a version that takes | 128 // TODO(creis): Make this private and replace this with a version that takes |
129 // in a routing ID. | 129 // in a routing ID. |
130 FrameTreeNode* FindByFrameID(int64 frame_id); | 130 FrameTreeNode* FindByFrameID(int64 frame_id); |
131 | 131 |
132 private: | 132 private: |
133 typedef std::pair<RenderViewHostImpl*, int> RenderViewHostRefCount; | 133 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; |
134 typedef base::hash_map<int, RenderViewHostRefCount> RenderViewHostMap; | 134 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; |
135 | 135 |
136 // These delegates are installed into all the RenderViewHosts and | 136 // These delegates are installed into all the RenderViewHosts and |
137 // RenderFrameHosts that we create. | 137 // RenderFrameHosts that we create. |
138 RenderFrameHostDelegate* render_frame_delegate_; | 138 RenderFrameHostDelegate* render_frame_delegate_; |
139 RenderViewHostDelegate* render_view_delegate_; | 139 RenderViewHostDelegate* render_view_delegate_; |
140 RenderWidgetHostDelegate* render_widget_delegate_; | 140 RenderWidgetHostDelegate* render_widget_delegate_; |
141 RenderFrameHostManager::Delegate* manager_delegate_; | 141 RenderFrameHostManager::Delegate* manager_delegate_; |
142 | 142 |
143 // Map of SiteInstance ID to a (RenderViewHost, refcount) pair. This allows | 143 // Map of SiteInstance ID to a RenderViewHost. This allows us to look up the |
144 // us to look up the RenderViewHost for a given SiteInstance when creating | 144 // RenderViewHost for a given SiteInstance when creating RenderFrameHosts, and |
145 // RenderFrameHosts, and it allows us to call Shutdown on the RenderViewHost | 145 // it allows us to call Shutdown on the RenderViewHost and remove it from the |
146 // and remove it from the map when no more RenderFrameHosts are using it. | 146 // map when no more RenderFrameHosts are using it. |
147 // | 147 // |
148 // Must be declared before |root_| so that it is deleted afterward. Otherwise | 148 // Must be declared before |root_| so that it is deleted afterward. Otherwise |
149 // the map will be cleared before we delete the RenderFrameHosts in the tree. | 149 // the map will be cleared before we delete the RenderFrameHosts in the tree. |
150 RenderViewHostMap render_view_host_map_; | 150 RenderViewHostMap render_view_host_map_; |
151 | 151 |
| 152 // Map of SiteInstance ID to RenderViewHosts that are pending shutdown. |
| 153 RenderViewHostMultiMap render_view_host_pending_shutdown_map_; |
| 154 |
152 scoped_ptr<FrameTreeNode> root_; | 155 scoped_ptr<FrameTreeNode> root_; |
153 | 156 |
154 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; | 157 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; |
155 | 158 |
156 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 159 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
157 }; | 160 }; |
158 | 161 |
159 } // namespace content | 162 } // namespace content |
160 | 163 |
161 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 164 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |