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

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

Issue 2226023003: Fix RenderView reuse issues after a pending RenderFrameHost dies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from creis@ and nasko@ Created 4 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // SiteInstance IDs, the values are RenderFrameProxyHosts. 501 // SiteInstance IDs, the values are RenderFrameProxyHosts.
502 const std::unordered_map<int32_t, std::unique_ptr<RenderFrameProxyHost>>& 502 const std::unordered_map<int32_t, std::unique_ptr<RenderFrameProxyHost>>&
503 GetAllProxyHostsForTesting() const { 503 GetAllProxyHostsForTesting() const {
504 return proxy_hosts_; 504 return proxy_hosts_;
505 } 505 }
506 506
507 // SiteInstanceImpl::Observer 507 // SiteInstanceImpl::Observer
508 void ActiveFrameCountIsZero(SiteInstanceImpl* site_instance) override; 508 void ActiveFrameCountIsZero(SiteInstanceImpl* site_instance) override;
509 void RenderProcessGone(SiteInstanceImpl* site_instance) override; 509 void RenderProcessGone(SiteInstanceImpl* site_instance) override;
510 510
511 // Cancels and destroys the pending or speculative RenderFrameHost if they
512 // match the provided |render_frame_host|.
513 void CancelPendingIfNecessary(RenderFrameHostImpl* render_frame_host);
514
511 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not 515 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not
512 // null, it creates a RenderFrameProxy in the target renderer process which is 516 // null, it creates a RenderFrameProxy in the target renderer process which is
513 // used to route IPC messages when in swapped out state. Returns early if the 517 // used to route IPC messages when in swapped out state. Returns early if the
514 // RenderViewHost has already been initialized for another RenderFrameHost. 518 // RenderViewHost has already been initialized for another RenderFrameHost.
515 bool InitRenderView(RenderViewHostImpl* render_view_host, 519 bool InitRenderView(RenderViewHostImpl* render_view_host,
516 RenderFrameProxyHost* proxy); 520 RenderFrameProxyHost* proxy);
517 521
518 // Terminates and deletes the pending RenderFrameHost.
519 void CancelPending();
520
521 private: 522 private:
522 friend class NavigatorTestWithBrowserSideNavigation; 523 friend class NavigatorTestWithBrowserSideNavigation;
523 friend class RenderFrameHostManagerTest; 524 friend class RenderFrameHostManagerTest;
524 friend class TestWebContents; 525 friend class TestWebContents;
525 526
526 enum class SiteInstanceRelation { 527 enum class SiteInstanceRelation {
527 // A SiteInstance in a different browsing instance from the current. 528 // A SiteInstance in a different browsing instance from the current.
528 UNRELATED, 529 UNRELATED,
529 // A SiteInstance in the same browsing instance as the current. 530 // A SiteInstance in the same browsing instance as the current.
530 RELATED, 531 RELATED,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // RenderFrameHost has committed. |old_render_frame_host| will either be 707 // RenderFrameHost has committed. |old_render_frame_host| will either be
707 // deleted or put on the pending delete list during this call. 708 // deleted or put on the pending delete list during this call.
708 void SwapOutOldFrame( 709 void SwapOutOldFrame(
709 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host); 710 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host);
710 711
711 // Discards a RenderFrameHost that was never made active (for active ones 712 // Discards a RenderFrameHost that was never made active (for active ones
712 // SwapOutOldFrame is used instead). 713 // SwapOutOldFrame is used instead).
713 void DiscardUnusedFrame( 714 void DiscardUnusedFrame(
714 std::unique_ptr<RenderFrameHostImpl> render_frame_host); 715 std::unique_ptr<RenderFrameHostImpl> render_frame_host);
715 716
717 // Terminates and deletes the pending RenderFrameHost.
718 void CancelPending();
719
716 // Clears pending_render_frame_host_, returning it to the caller for disposal. 720 // Clears pending_render_frame_host_, returning it to the caller for disposal.
717 std::unique_ptr<RenderFrameHostImpl> UnsetPendingRenderFrameHost(); 721 std::unique_ptr<RenderFrameHostImpl> UnsetPendingRenderFrameHost();
718 722
719 // Helper method to set the active RenderFrameHost. Returns the old 723 // Helper method to set the active RenderFrameHost. Returns the old
720 // RenderFrameHost and updates counts. 724 // RenderFrameHost and updates counts.
721 std::unique_ptr<RenderFrameHostImpl> SetRenderFrameHost( 725 std::unique_ptr<RenderFrameHostImpl> SetRenderFrameHost(
722 std::unique_ptr<RenderFrameHostImpl> render_frame_host); 726 std::unique_ptr<RenderFrameHostImpl> render_frame_host);
723 727
724 RenderFrameHostImpl* UpdateStateForNavigate( 728 RenderFrameHostImpl* UpdateStateForNavigate(
725 const GURL& dest_url, 729 const GURL& dest_url,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 std::unique_ptr<RenderFrameHostImpl> speculative_render_frame_host_; 806 std::unique_ptr<RenderFrameHostImpl> speculative_render_frame_host_;
803 807
804 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 808 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
805 809
806 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 810 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
807 }; 811 };
808 812
809 } // namespace content 813 } // namespace content
810 814
811 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 815 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698