| 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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <list> | 10 #include <list> |
| 9 #include <map> | 11 #include <map> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 15 #include "content/browser/frame_host/render_frame_host_impl.h" | 17 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_view_host_delegate.h" | 18 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 17 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
| 18 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 19 #include "content/public/browser/global_request_id.h" | 21 #include "content/public/browser/global_request_id.h" |
| 20 #include "content/public/common/referrer.h" | 22 #include "content/public/common/referrer.h" |
| 21 #include "ui/base/page_transition_types.h" | 23 #include "ui/base/page_transition_types.h" |
| 22 #include "url/origin.h" | 24 #include "url/origin.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 RenderFrameHostManager( | 194 RenderFrameHostManager( |
| 193 FrameTreeNode* frame_tree_node, | 195 FrameTreeNode* frame_tree_node, |
| 194 RenderFrameHostDelegate* render_frame_delegate, | 196 RenderFrameHostDelegate* render_frame_delegate, |
| 195 RenderViewHostDelegate* render_view_delegate, | 197 RenderViewHostDelegate* render_view_delegate, |
| 196 RenderWidgetHostDelegate* render_widget_delegate, | 198 RenderWidgetHostDelegate* render_widget_delegate, |
| 197 Delegate* delegate); | 199 Delegate* delegate); |
| 198 ~RenderFrameHostManager(); | 200 ~RenderFrameHostManager(); |
| 199 | 201 |
| 200 // For arguments, see WebContentsImpl constructor. | 202 // For arguments, see WebContentsImpl constructor. |
| 201 void Init(SiteInstance* site_instance, | 203 void Init(SiteInstance* site_instance, |
| 202 int32 view_routing_id, | 204 int32_t view_routing_id, |
| 203 int32 frame_routing_id, | 205 int32_t frame_routing_id, |
| 204 int32 widget_routing_id); | 206 int32_t widget_routing_id); |
| 205 | 207 |
| 206 // Returns the currently active RenderFrameHost. | 208 // Returns the currently active RenderFrameHost. |
| 207 // | 209 // |
| 208 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 210 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
| 209 // check it in many cases, however. Windows can send us messages during the | 211 // check it in many cases, however. Windows can send us messages during the |
| 210 // destruction process after it has been shut down. | 212 // destruction process after it has been shut down. |
| 211 RenderFrameHostImpl* current_frame_host() const { | 213 RenderFrameHostImpl* current_frame_host() const { |
| 212 return render_frame_host_.get(); | 214 return render_frame_host_.get(); |
| 213 } | 215 } |
| 214 | 216 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // In case |existing_site_instance| is null, specify a new site URL. | 514 // In case |existing_site_instance| is null, specify a new site URL. |
| 513 GURL new_site_url; | 515 GURL new_site_url; |
| 514 | 516 |
| 515 // In case |existing_site_instance| is null, specify if the new site should | 517 // In case |existing_site_instance| is null, specify if the new site should |
| 516 // be created in a new BrowsingInstance or not. | 518 // be created in a new BrowsingInstance or not. |
| 517 bool new_is_related_to_current; | 519 bool new_is_related_to_current; |
| 518 }; | 520 }; |
| 519 | 521 |
| 520 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a | 522 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a |
| 521 // FrameTreeNode's RenderFrameHostManager. | 523 // FrameTreeNode's RenderFrameHostManager. |
| 522 static bool ClearProxiesInSiteInstance(int32 site_instance_id, | 524 static bool ClearProxiesInSiteInstance(int32_t site_instance_id, |
| 523 FrameTreeNode* node); | 525 FrameTreeNode* node); |
| 524 // Used with FrameTree::ForEach to reset initialized state of | 526 // Used with FrameTree::ForEach to reset initialized state of |
| 525 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. | 527 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. |
| 526 static bool ResetProxiesInSiteInstance(int32 site_instance_id, | 528 static bool ResetProxiesInSiteInstance(int32_t site_instance_id, |
| 527 FrameTreeNode* node); | 529 FrameTreeNode* node); |
| 528 | 530 |
| 529 // Returns whether this tab should transition to a new renderer for | 531 // Returns whether this tab should transition to a new renderer for |
| 530 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 532 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| 531 // switch. Can be overridden in unit tests. | 533 // switch. Can be overridden in unit tests. |
| 532 bool ShouldTransitionCrossSite(); | 534 bool ShouldTransitionCrossSite(); |
| 533 | 535 |
| 534 // Returns true if for the navigation from |current_effective_url| to | 536 // Returns true if for the navigation from |current_effective_url| to |
| 535 // |new_effective_url|, a new SiteInstance and BrowsingInstance should be | 537 // |new_effective_url|, a new SiteInstance and BrowsingInstance should be |
| 536 // created (even if we are in a process model that doesn't usually swap). | 538 // created (even if we are in a process model that doesn't usually swap). |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 625 |
| 624 // Create swapped out RenderViews and RenderFrameProxies in the given | 626 // Create swapped out RenderViews and RenderFrameProxies in the given |
| 625 // SiteInstance for the current node's FrameTree. Used as a helper function | 627 // SiteInstance for the current node's FrameTree. Used as a helper function |
| 626 // in CreateOpenerProxies for creating proxies in each FrameTree on the | 628 // in CreateOpenerProxies for creating proxies in each FrameTree on the |
| 627 // opener chain. Don't create proxies for the subtree rooted at | 629 // opener chain. Don't create proxies for the subtree rooted at |
| 628 // |skip_this_node|. | 630 // |skip_this_node|. |
| 629 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, | 631 void CreateOpenerProxiesForFrameTree(SiteInstance* instance, |
| 630 FrameTreeNode* skip_this_node); | 632 FrameTreeNode* skip_this_node); |
| 631 | 633 |
| 632 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. | 634 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. |
| 633 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, | 635 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost( |
| 634 int32 view_routing_id, | 636 SiteInstance* instance, |
| 635 int32 frame_routing_id, | 637 int32_t view_routing_id, |
| 636 int32 widget_routing_id, | 638 int32_t frame_routing_id, |
| 637 int flags); | 639 int32_t widget_routing_id, |
| 640 int flags); |
| 638 | 641 |
| 639 // PlzNavigate | 642 // PlzNavigate |
| 640 // Create and initialize a speculative RenderFrameHost for an ongoing | 643 // Create and initialize a speculative RenderFrameHost for an ongoing |
| 641 // navigation. It might be destroyed and re-created later if the navigation | 644 // navigation. It might be destroyed and re-created later if the navigation |
| 642 // is redirected to a different SiteInstance. | 645 // is redirected to a different SiteInstance. |
| 643 bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance, | 646 bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance, |
| 644 SiteInstance* new_instance); | 647 SiteInstance* new_instance); |
| 645 | 648 |
| 646 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not | 649 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not |
| 647 // null, it creates a RenderFrameProxy in the target renderer process which is | 650 // null, it creates a RenderFrameProxy in the target renderer process which is |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 788 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
| 786 | 789 |
| 787 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 790 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| 788 | 791 |
| 789 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 792 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| 790 }; | 793 }; |
| 791 | 794 |
| 792 } // namespace content | 795 } // namespace content |
| 793 | 796 |
| 794 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 797 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| OLD | NEW |