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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
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 on the pending RFH. It creates a | |
Charlie Reis
2014/10/10 16:20:40
nit: s/on/from/
ncarter (slow)
2014/10/13 17:41:59
Done.
| |
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 Loading... | |
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_ |
OLD | NEW |