| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Returns the existing RenderViewHost for a new subframe RenderFrameHost. | 117 // Returns the existing RenderViewHost for a new subframe RenderFrameHost. |
| 118 // There should always be such a RenderViewHost, because the main frame | 118 // There should always be such a RenderViewHost, because the main frame |
| 119 // RenderFrameHost for each SiteInstance should be created before subframes. | 119 // RenderFrameHost for each SiteInstance should be created before subframes. |
| 120 RenderViewHostImpl* GetRenderViewHostForSubFrame(SiteInstance* site_instance); | 120 RenderViewHostImpl* GetRenderViewHostForSubFrame(SiteInstance* site_instance); |
| 121 | 121 |
| 122 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When | 122 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When |
| 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|. |
| 128 // TODO(creis): Make this private and replace this with a version that takes |
| 129 // in a routing ID. |
| 130 FrameTreeNode* FindByFrameID(int64 frame_id); |
| 131 |
| 127 private: | 132 private: |
| 128 typedef std::pair<RenderViewHostImpl*, int> RenderViewHostRefCount; | 133 typedef std::pair<RenderViewHostImpl*, int> RenderViewHostRefCount; |
| 129 typedef base::hash_map<int, RenderViewHostRefCount> RenderViewHostMap; | 134 typedef base::hash_map<int, RenderViewHostRefCount> RenderViewHostMap; |
| 130 | 135 |
| 131 // Returns the FrameTreeNode with the given renderer-specific |frame_id|. | |
| 132 // For internal use only. | |
| 133 // TODO(creis): Replace this with a version that takes in a routing ID. | |
| 134 FrameTreeNode* FindByFrameID(int64 frame_id); | |
| 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, refcount) pair. This allows |
| 144 // us to look up the RenderViewHost for a given SiteInstance when creating | 144 // us to look up the RenderViewHost for a given SiteInstance when creating |
| 145 // RenderFrameHosts, and it allows us to call Shutdown on the RenderViewHost | 145 // RenderFrameHosts, and it allows us to call Shutdown on the RenderViewHost |
| 146 // and remove it from the map when no more RenderFrameHosts are using it. | 146 // and remove it from the 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 scoped_ptr<FrameTreeNode> root_; | 152 scoped_ptr<FrameTreeNode> root_; |
| 153 | 153 |
| 154 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; | 154 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 156 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| 160 | 160 |
| 161 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 161 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
| OLD | NEW |