Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 1268153002: Refactor CreateOpenerProxies to support updates to frame openers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 // Returns a copy of the map of proxy hosts. The keys are SiteInstance IDs, 476 // Returns a copy of the map of proxy hosts. The keys are SiteInstance IDs,
477 // the values are RenderFrameProxyHosts. 477 // the values are RenderFrameProxyHosts.
478 std::map<int, RenderFrameProxyHost*> GetAllProxyHostsForTesting(); 478 std::map<int, RenderFrameProxyHost*> GetAllProxyHostsForTesting();
479 479
480 private: 480 private:
481 friend class NavigatorTestWithBrowserSideNavigation; 481 friend class NavigatorTestWithBrowserSideNavigation;
482 friend class RenderFrameHostManagerTest; 482 friend class RenderFrameHostManagerTest;
483 friend class TestWebContents; 483 friend class TestWebContents;
484 484
485 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest,
486 TraverseComplexOpenerChain);
Charlie Reis 2015/08/05 23:59:09 Maybe we can expose CollectOpenerFrameTrees via Re
alexmos 2015/08/06 17:05:39 Done.
487
485 // Stores information regarding a SiteInstance targeted at a specific URL to 488 // Stores information regarding a SiteInstance targeted at a specific URL to
486 // allow for comparisons without having to actually create new instances. It 489 // allow for comparisons without having to actually create new instances. It
487 // can point to an existing one or store the details needed to create a new 490 // can point to an existing one or store the details needed to create a new
488 // one. 491 // one.
489 struct CONTENT_EXPORT SiteInstanceDescriptor { 492 struct CONTENT_EXPORT SiteInstanceDescriptor {
490 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) 493 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance)
491 : existing_site_instance(site_instance), 494 : existing_site_instance(site_instance),
492 new_is_related_to_current(false) {} 495 new_is_related_to_current(false) {}
493 496
494 SiteInstanceDescriptor(BrowserContext* browser_context, 497 SiteInstanceDescriptor(BrowserContext* browser_context,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance, 614 void CreateProxiesForNewRenderFrameHost(SiteInstance* old_instance,
612 SiteInstance* new_instance, 615 SiteInstance* new_instance,
613 int* create_render_frame_flags); 616 int* create_render_frame_flags);
614 617
615 // Create swapped out RenderViews and RenderFrameProxies in the given 618 // Create swapped out RenderViews and RenderFrameProxies in the given
616 // SiteInstance for all frames on the opener chain of this frame. Same as 619 // SiteInstance for all frames on the opener chain of this frame. Same as
617 // CreateOpenerProxies, but starts from this frame's opener, calling 620 // CreateOpenerProxies, but starts from this frame's opener, calling
618 // CreateOpenerProxies on it if it exists and returning otherwise. 621 // CreateOpenerProxies on it if it exists and returning otherwise.
619 void CreateOpenerProxiesIfNeeded(SiteInstance* instance); 622 void CreateOpenerProxiesIfNeeded(SiteInstance* instance);
620 623
624 // Traverse the opener chain and populate |opener_frame_trees| with
625 // all FrameTrees accessible by following frame openers of nodes in the
626 // current node's FrameTree. |opener_frame_trees| is ordered so that openers
627 // of smaller-indexed entries point to larger-indexed entries (i.e., this
628 // node's FrameTree is at index 0, its opener's FrameTree is at index 1,
629 // etc). If the traversal encounters a node with an opener pointing to a
630 // FrameTree that has already been traversed (such as when there's a cycle),
631 // the node is added to |nodes_with_back_links|.
632 void CollectOpenerFrameTrees(
633 std::vector<FrameTree*>* opener_frame_trees,
634 base::hash_set<FrameTreeNode*>* nodes_with_back_links);
635
636 // Create swapped out RenderViews and RenderFrameProxies in the given
637 // SiteInstance for the current node's FrameTree. Used as a helper function
638 // in CreateOpenerProxies for creating proxies in each FrameTree on the
639 // opener chain.
640 void CreateOpenerProxiesForFrameTree(SiteInstance* instance);
641
621 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. 642 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary.
622 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, 643 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance,
623 int view_routing_id, 644 int view_routing_id,
624 int frame_routing_id, 645 int frame_routing_id,
625 int flags); 646 int flags);
626 647
627 // PlzNavigate 648 // PlzNavigate
628 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an 649 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an
629 // ongoing navigation. They might be destroyed and re-created later if the 650 // ongoing navigation. They might be destroyed and re-created later if the
630 // navigation is redirected to a different SiteInstance. 651 // navigation is redirected to a different SiteInstance.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 bool should_reuse_web_ui_; 814 bool should_reuse_web_ui_;
794 815
795 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 816 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
796 817
797 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 818 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
798 }; 819 };
799 820
800 } // namespace content 821 } // namespace content
801 822
802 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 823 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698