OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 // there is no current one. | 117 // there is no current one. |
118 content::RenderWidgetHostView* GetRenderWidgetHostView() const; | 118 content::RenderWidgetHostView* GetRenderWidgetHostView() const; |
119 | 119 |
120 // Returns the pending render view host, or NULL if there is no pending one. | 120 // Returns the pending render view host, or NULL if there is no pending one. |
121 content::RenderViewHostImpl* pending_render_view_host() const; | 121 content::RenderViewHostImpl* pending_render_view_host() const; |
122 | 122 |
123 // Returns the current committed Web UI or NULL if none applies. | 123 // Returns the current committed Web UI or NULL if none applies. |
124 WebUIImpl* web_ui() const { return web_ui_.get(); } | 124 WebUIImpl* web_ui() const { return web_ui_.get(); } |
125 | 125 |
126 // Returns the Web UI for the pending navigation, or NULL of none applies. | 126 // Returns the Web UI for the pending navigation, or NULL of none applies. |
127 WebUIImpl* pending_web_ui() const { return pending_web_ui_.get(); } | 127 WebUIImpl* pending_web_ui() const { return pending_web_ui_; } |
128 | 128 |
129 // Called when we want to instruct the renderer to navigate to the given | 129 // Called when we want to instruct the renderer to navigate to the given |
130 // navigation entry. It may create a new RenderViewHost or re-use an existing | 130 // navigation entry. It may create a new RenderViewHost or re-use an existing |
131 // one. The RenderViewHost to navigate will be returned. Returns NULL if one | 131 // one. The RenderViewHost to navigate will be returned. Returns NULL if one |
132 // could not be created. | 132 // could not be created. |
133 content::RenderViewHostImpl* Navigate( | 133 content::RenderViewHostImpl* Navigate( |
134 const content::NavigationEntryImpl& entry); | 134 const content::NavigationEntryImpl& entry); |
135 | 135 |
136 // Instructs the various live views to stop. Called when the user directed the | 136 // Instructs the various live views to stop. Called when the user directed the |
137 // page to stop loading. | 137 // page to stop loading. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 // Returns true if the two navigation entries are incompatible in some way | 212 // Returns true if the two navigation entries are incompatible in some way |
213 // other than site instances. Cases where this can happen include Web UI | 213 // other than site instances. Cases where this can happen include Web UI |
214 // to regular web pages. It will cause us to swap RenderViewHosts (and hence | 214 // to regular web pages. It will cause us to swap RenderViewHosts (and hence |
215 // RenderProcessHosts) even if the site instance would otherwise be the same. | 215 // RenderProcessHosts) even if the site instance would otherwise be the same. |
216 // As part of this, we'll also force new SiteInstances and BrowsingInstances. | 216 // As part of this, we'll also force new SiteInstances and BrowsingInstances. |
217 // Either of the entries may be NULL. | 217 // Either of the entries may be NULL. |
218 bool ShouldSwapProcessesForNavigation( | 218 bool ShouldSwapProcessesForNavigation( |
219 const content::NavigationEntry* cur_entry, | 219 const content::NavigationEntry* cur_entry, |
220 const content::NavigationEntryImpl* new_entry) const; | 220 const content::NavigationEntryImpl* new_entry) const; |
221 | 221 |
222 bool ShouldReuseWebUI( | |
223 const content::NavigationEntry* curr_entry, | |
Dan Beam
2012/04/21 02:53:07
can you change this to cur_entry or change above t
Evan Stade
2012/04/24 17:52:40
Done.
| |
224 const content::NavigationEntryImpl* new_entry) const; | |
225 | |
222 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 226 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
223 // possibly reusing the current SiteInstance. | 227 // possibly reusing the current SiteInstance. |
224 // Never called if --process-per-tab is used. | 228 // Never called if --process-per-tab is used. |
225 content::SiteInstance* GetSiteInstanceForEntry( | 229 content::SiteInstance* GetSiteInstanceForEntry( |
226 const content::NavigationEntryImpl& entry, | 230 const content::NavigationEntryImpl& entry, |
227 content::SiteInstance* curr_instance); | 231 content::SiteInstance* curr_instance); |
228 | 232 |
229 // Helper method to create a pending RenderViewHost for a cross-site | 233 // Helper method to create a pending RenderViewHost for a cross-site |
230 // navigation. | 234 // navigation. |
231 bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, | 235 bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, |
(...skipping 12 matching lines...) Expand all Loading... | |
244 // Helper method to terminate the pending RenderViewHost. | 248 // Helper method to terminate the pending RenderViewHost. |
245 void CancelPending(); | 249 void CancelPending(); |
246 | 250 |
247 content::RenderViewHostImpl* UpdateRendererStateForNavigate( | 251 content::RenderViewHostImpl* UpdateRendererStateForNavigate( |
248 const content::NavigationEntryImpl& entry); | 252 const content::NavigationEntryImpl& entry); |
249 | 253 |
250 // Called when a renderer process is starting to close. We should not | 254 // Called when a renderer process is starting to close. We should not |
251 // schedule new navigations in its swapped out RenderViewHosts after this. | 255 // schedule new navigations in its swapped out RenderViewHosts after this. |
252 void RendererProcessClosing(content::RenderProcessHost* render_process_host); | 256 void RendererProcessClosing(content::RenderProcessHost* render_process_host); |
253 | 257 |
258 // Deletes |pending_web_ui_|, making sure not to double-free in the case where | |
259 // it is the same as |web_ui_|. | |
260 void FreePendingWebUI(); | |
261 | |
254 // Our delegate, not owned by us. Guaranteed non-NULL. | 262 // Our delegate, not owned by us. Guaranteed non-NULL. |
255 Delegate* delegate_; | 263 Delegate* delegate_; |
256 | 264 |
257 // Whether a navigation requiring different RenderView's is pending. This is | 265 // Whether a navigation requiring different RenderView's is pending. This is |
258 // either cross-site request is (in the new process model), or when required | 266 // either cross-site request is (in the new process model), or when required |
259 // for the view type (like view source versus not). | 267 // for the view type (like view source versus not). |
260 bool cross_navigation_pending_; | 268 bool cross_navigation_pending_; |
261 | 269 |
262 // Implemented by the owner of this class, this delegate is installed into all | 270 // Implemented by the owner of this class, this delegate is installed into all |
263 // the RenderViewHosts that we create. | 271 // the RenderViewHosts that we create. |
264 content::RenderViewHostDelegate* render_view_delegate_; | 272 content::RenderViewHostDelegate* render_view_delegate_; |
265 | 273 |
266 // Our RenderView host and its associated Web UI (if any, will be NULL for | 274 // Our RenderView host and its associated Web UI (if any, will be NULL for |
267 // non-DOM-UI pages). This object is responsible for all communication with | 275 // non-DOM-UI pages). This object is responsible for all communication with |
268 // a child RenderView instance. | 276 // a child RenderView instance. |
269 content::RenderViewHostImpl* render_view_host_; | 277 content::RenderViewHostImpl* render_view_host_; |
270 scoped_ptr<WebUIImpl> web_ui_; | 278 scoped_ptr<WebUIImpl> web_ui_; |
271 | 279 |
272 // A RenderViewHost used to load a cross-site page. This remains hidden | 280 // A RenderViewHost used to load a cross-site page. This remains hidden |
273 // while a cross-site request is pending until it calls DidNavigate. It may | 281 // while a cross-site request is pending until it calls DidNavigate. It may |
274 // have an associated Web UI, in which case the Web UI pointer will be non- | 282 // have an associated Web UI, in which case the Web UI pointer will be non- |
275 // NULL. | 283 // NULL. |
276 // | 284 // |
277 // The pending_web_ui may be non-NULL even when the pending_render_view_host_ | 285 // The pending_web_ui_ may be non-NULL even when the pending_render_view_host_ |
Dan Beam
2012/04/21 02:53:07
nit: |pending_web_ui_| and |pending_render_view_ho
Evan Stade
2012/04/24 17:52:40
Done.
| |
278 // is. This will happen when we're transitioning between two Web UI pages: | 286 // is. This will happen when we're transitioning between two Web UI pages: |
279 // the RVH won't be swapped, so the pending pointer will be unused, but there | 287 // the RVH won't be swapped, so the pending pointer will be unused, but there |
280 // will be a pending Web UI associated with the navigation. | 288 // will be a pending Web UI associated with the navigation. |
281 content::RenderViewHostImpl* pending_render_view_host_; | 289 content::RenderViewHostImpl* pending_render_view_host_; |
282 scoped_ptr<WebUIImpl> pending_web_ui_; | 290 |
291 // If non-NULL, the pending navigation is to a chrome: page. The pointer may | |
292 // be a unique WebUIImpl, or may be a copy of web_ui_, in which case the same | |
293 // WebUIImpl* will be reused for the next navigation. | |
294 WebUIImpl* pending_web_ui_; | |
stuartmorgan
2012/04/24 09:12:20
This memory model makes me *extremely* nervous; I
Evan Stade
2012/04/24 17:52:40
Done.
| |
283 | 295 |
284 // A map of site instance ID to swapped out RenderViewHosts. | 296 // A map of site instance ID to swapped out RenderViewHosts. |
285 typedef base::hash_map<int32, content::RenderViewHostImpl*> RenderViewHostMap; | 297 typedef base::hash_map<int32, content::RenderViewHostImpl*> RenderViewHostMap; |
286 RenderViewHostMap swapped_out_hosts_; | 298 RenderViewHostMap swapped_out_hosts_; |
287 | 299 |
288 // The intersitial page currently shown if any, not own by this class | 300 // The intersitial page currently shown if any, not own by this class |
289 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 301 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
290 InterstitialPageImpl* interstitial_page_; | 302 InterstitialPageImpl* interstitial_page_; |
291 | 303 |
292 content::NotificationRegistrar registrar_; | 304 content::NotificationRegistrar registrar_; |
293 | 305 |
294 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 306 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
295 }; | 307 }; |
296 | 308 |
297 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 309 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
OLD | NEW |