OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // to the current RVH. | 96 // to the current RVH. |
97 // - Once the onunload handler is finished, a SwapOut_ACK message is sent to | 97 // - Once the onunload handler is finished, a SwapOut_ACK message is sent to |
98 // the ResourceDispatcherHost, who unpauses the response. Data is then sent | 98 // the ResourceDispatcherHost, who unpauses the response. Data is then sent |
99 // to the pending RVH. | 99 // to the pending RVH. |
100 // - The pending renderer sends a FrameNavigate message that invokes the | 100 // - The pending renderer sends a FrameNavigate message that invokes the |
101 // DidNavigate method. This replaces the current RVH with the | 101 // DidNavigate method. This replaces the current RVH with the |
102 // pending RVH. | 102 // pending RVH. |
103 // - The previous renderer is kept swapped out in RenderViewHostManager in case | 103 // - The previous renderer is kept swapped out in RenderViewHostManager in case |
104 // the user goes back. The process only stays live if another tab is using | 104 // the user goes back. The process only stays live if another tab is using |
105 // it, but if so, the existing frame relationships will be maintained. | 105 // it, but if so, the existing frame relationships will be maintained. |
106 // | |
107 // It is possible that we trigger a new navigation after we have received | |
108 // a SwapOut_ACK message but before the FrameNavigation has been confirmed. | |
109 // In this case the old RVH has been swapped out but the new one has not | |
110 // replaced it, yet. Therefore, we cancel the pending RVH and skip the unloading | |
111 // of the old RVH. | |
112 | 106 |
113 using content::DevToolsAgentHost; | 107 using content::DevToolsAgentHost; |
114 using content::DevToolsAgentHostRegistry; | 108 using content::DevToolsAgentHostRegistry; |
115 using content::DevToolsManagerImpl; | 109 using content::DevToolsManagerImpl; |
116 using content::DownloadItem; | 110 using content::DownloadItem; |
117 using content::DownloadManager; | 111 using content::DownloadManager; |
118 using content::GlobalRequestID; | 112 using content::GlobalRequestID; |
119 using content::NavigationController; | 113 using content::NavigationController; |
120 using content::NavigationEntry; | 114 using content::NavigationEntry; |
121 using content::NavigationEntryImpl; | 115 using content::NavigationEntryImpl; |
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 encoding_ = content::GetContentClient()->browser()-> | 2273 encoding_ = content::GetContentClient()->browser()-> |
2280 GetCanonicalEncodingNameByAliasName(encoding); | 2274 GetCanonicalEncodingNameByAliasName(encoding); |
2281 } | 2275 } |
2282 | 2276 |
2283 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2277 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2284 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2278 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2285 // Can be NULL during tests. | 2279 // Can be NULL during tests. |
2286 if (rwh_view) | 2280 if (rwh_view) |
2287 rwh_view->SetSize(GetView()->GetContainerSize()); | 2281 rwh_view->SetSize(GetView()->GetContainerSize()); |
2288 } | 2282 } |
OLD | NEW |