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

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

Issue 648563002: Revitalize (and move) a block comment about how cross-process navigation works. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@is_rfh_swapped
Patch Set: Fix nit Created 6 years, 2 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
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 26 matching lines...) Expand all
37 class RenderFrameHostImpl; 37 class RenderFrameHostImpl;
38 class RenderFrameHostManagerTest; 38 class RenderFrameHostManagerTest;
39 class RenderFrameProxyHost; 39 class RenderFrameProxyHost;
40 class RenderViewHost; 40 class RenderViewHost;
41 class RenderViewHostImpl; 41 class RenderViewHostImpl;
42 class RenderWidgetHostDelegate; 42 class RenderWidgetHostDelegate;
43 class RenderWidgetHostView; 43 class RenderWidgetHostView;
44 class TestWebContents; 44 class TestWebContents;
45 class WebUIImpl; 45 class WebUIImpl;
46 46
47 // Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state 47 // Manages RenderFrameHosts for a FrameTreeNode. It maintains a
48 // machine to make cross-process navigations in a frame possible. 48 // current_frame_host() which is the content currently visible to the user. When
49 // a frame is told to navigate to a different web site (as determined by
50 // SiteInstance), it will replace its current RenderFrameHost with a new
51 // RenderFrameHost dedicated to the new SiteInstance, possibly in a new process.
52 //
53 // Cross-process navigation works like this:
54 //
55 // - RFHM::Navigate determines whether the destination is cross-site, and if so,
56 // it creates a pending_render_frame_host_.
57 //
58 // - The pending RFH is created in the "navigations suspended" state, meaning no
59 // navigation messages are sent to its renderer until the beforeunload handler
60 // has a chance to run in the current RFH.
61 //
62 // - The current RFH runs its beforeunload handler. If it returns false, we
63 // cancel all the pending logic. Otherwise we allow the pending RFH to send
64 // the navigation request to its renderer.
65 //
66 // - ResourceDispatcherHost receives a ResourceRequest on the IO thread for the
67 // main resource load from the pending RFH. It creates a
68 // CrossSiteResourceHandler to check whether a process transfer is needed when
69 // the request is ready to commit.
70 //
71 // - When RDH receives a response, the BufferedResourceHandler determines
72 // whether it is a navigation type that doesn't commit (e.g. download, 204 or
73 // error page). If so, it sends a message to the new renderer causing it to
74 // cancel the request, and the request (e.g. the download) proceeds. In this
75 // case, the pending RFH will never become the current RFH, but it remains
76 // until the next DidNavigate event for this WebContentsImpl.
77 //
78 // - After RDH receives a response and determines that it is safe and not a
79 // download, the CrossSiteResourceHandler checks whether a transfer for a
80 // redirect is needed. If so, it pauses the network response and starts an
81 // identical navigation in a new pending RFH. When the identical request is
82 // later received by RDH, the response is transferred and unpaused.
83 //
84 // - Otherwise, the network response commits in the pending RFH's renderer,
85 // which sends a DidCommitProvisionalLoad message back to the browser process.
86 //
87 // - RFHM::CommitPending makes visible the new RFH, and initiates the unload
88 // handler in the old RFH. The unload handler will complete in the background.
89 //
90 // - RenderFrameHostManager may keep the previous RFH alive as a
91 // RenderFrameProxyHost, to be used (for example) if the user goes back. The
92 // process only stays live if another tab is using it, but if so, the existing
93 // frame relationships will be maintained.
49 class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { 94 class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
50 public: 95 public:
51 // Functions implemented by our owner that we need. 96 // Functions implemented by our owner that we need.
52 // 97 //
53 // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl 98 // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl
54 // that are required to run this class. The design should probably be better 99 // that are required to run this class. The design should probably be better
55 // such that these are more clear. 100 // such that these are more clear.
56 // 101 //
57 // There is additional complexity that some of the functions we need in 102 // There is additional complexity that some of the functions we need in
58 // WebContentsImpl are inherited and non-virtual. These are named with 103 // WebContentsImpl are inherited and non-virtual. These are named with
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 NotificationRegistrar registrar_; 576 NotificationRegistrar registrar_;
532 577
533 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 578 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
534 579
535 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 580 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
536 }; 581 };
537 582
538 } // namespace content 583 } // namespace content
539 584
540 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 585 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698