OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // to the current RVH. | 92 // to the current RVH. |
93 // - Once the onunload handler is finished, a SwapOut_ACK message is sent to | 93 // - Once the onunload handler is finished, a SwapOut_ACK message is sent to |
94 // the ResourceDispatcherHost, who unpauses the response. Data is then sent | 94 // the ResourceDispatcherHost, who unpauses the response. Data is then sent |
95 // to the pending RVH. | 95 // to the pending RVH. |
96 // - The pending renderer sends a FrameNavigate message that invokes the | 96 // - The pending renderer sends a FrameNavigate message that invokes the |
97 // DidNavigate method. This replaces the current RVH with the | 97 // DidNavigate method. This replaces the current RVH with the |
98 // pending RVH. | 98 // pending RVH. |
99 // - The previous renderer is kept swapped out in RenderViewHostManager in case | 99 // - The previous renderer is kept swapped out in RenderViewHostManager in case |
100 // the user goes back. The process only stays live if another tab is using | 100 // the user goes back. The process only stays live if another tab is using |
101 // it, but if so, the existing frame relationships will be maintained. | 101 // it, but if so, the existing frame relationships will be maintained. |
| 102 // |
| 103 // It is possible that we trigger a new navigation after we have received |
| 104 // a SwapOut_ACK message but before the FrameNavigation has been confirmed. |
| 105 // In this case the old RVH has been swapped out but the new one has not |
| 106 // replaced it, yet. Therefore, we cancel the pending RVH and skip the unloading |
| 107 // of the old RVH. |
102 | 108 |
103 namespace { | 109 namespace { |
104 | 110 |
105 // Amount of time we wait between when a key event is received and the renderer | 111 // Amount of time we wait between when a key event is received and the renderer |
106 // is queried for its state and pushed to the NavigationEntry. | 112 // is queried for its state and pushed to the NavigationEntry. |
107 const int kQueryStateDelay = 5000; | 113 const int kQueryStateDelay = 5000; |
108 | 114 |
109 const int kSyncWaitDelay = 40; | 115 const int kSyncWaitDelay = 40; |
110 | 116 |
111 static const char kDotGoogleDotCom[] = ".google.com"; | 117 static const char kDotGoogleDotCom[] = ".google.com"; |
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2036 |
2031 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2037 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2032 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2038 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2033 rwh_view->SetSize(view()->GetContainerSize()); | 2039 rwh_view->SetSize(view()->GetContainerSize()); |
2034 } | 2040 } |
2035 | 2041 |
2036 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2042 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
2037 return render_view_host() ? | 2043 return render_view_host() ? |
2038 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2044 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
2039 } | 2045 } |
OLD | NEW |