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 #include "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 bool RenderFrameHostManager::ShouldCloseTabOnUnresponsiveRenderer() { | 275 bool RenderFrameHostManager::ShouldCloseTabOnUnresponsiveRenderer() { |
276 if (!cross_navigation_pending_) | 276 if (!cross_navigation_pending_) |
277 return true; | 277 return true; |
278 | 278 |
279 // We should always have a pending RFH when there's a cross-process navigation | 279 // We should always have a pending RFH when there's a cross-process navigation |
280 // in progress. Sanity check this for http://crbug.com/276333. | 280 // in progress. Sanity check this for http://crbug.com/276333. |
281 CHECK(pending_render_frame_host_); | 281 CHECK(pending_render_frame_host_); |
282 | 282 |
283 // If the tab becomes unresponsive during {before}unload while doing a | 283 // Unload handlers run in the background, so we should never get an |
| 284 // unresponsiveness warning for them. |
| 285 CHECK(!render_frame_host_->IsWaitingForUnloadACK()); |
| 286 |
| 287 // If the tab becomes unresponsive during beforeunload while doing a |
284 // cross-site navigation, proceed with the navigation. (This assumes that | 288 // cross-site navigation, proceed with the navigation. (This assumes that |
285 // the pending RenderFrameHost is still responsive.) | 289 // the pending RenderFrameHost is still responsive.) |
286 if (render_frame_host_->IsWaitingForUnloadACK()) { | 290 if (render_frame_host_->is_waiting_for_beforeunload_ack()) { |
287 // The request has been started and paused while we're waiting for the | |
288 // unload handler to finish. We'll pretend that it did. The pending | |
289 // renderer will then be swapped in as part of the usual DidNavigate logic. | |
290 // (If the unload handler later finishes, this call will be ignored because | |
291 // the pending_nav_params_ state will already be cleaned up.) | |
292 current_frame_host()->OnSwappedOut(); | |
293 } else if (render_frame_host_->is_waiting_for_beforeunload_ack()) { | |
294 // Haven't gotten around to starting the request, because we're still | 291 // Haven't gotten around to starting the request, because we're still |
295 // waiting for the beforeunload handler to finish. We'll pretend that it | 292 // waiting for the beforeunload handler to finish. We'll pretend that it |
296 // did finish, to let the navigation proceed. Note that there's a danger | 293 // did finish, to let the navigation proceed. Note that there's a danger |
297 // that the beforeunload handler will later finish and possibly return | 294 // that the beforeunload handler will later finish and possibly return |
298 // false (meaning the navigation should not proceed), but we'll ignore it | 295 // false (meaning the navigation should not proceed), but we'll ignore it |
299 // in this case because it took too long. | 296 // in this case because it took too long. |
300 if (pending_render_frame_host_->are_navigations_suspended()) { | 297 if (pending_render_frame_host_->are_navigations_suspended()) { |
301 pending_render_frame_host_->SetNavigationsSuspended( | 298 pending_render_frame_host_->SetNavigationsSuspended( |
302 false, base::TimeTicks::Now()); | 299 false, base::TimeTicks::Now()); |
303 } | 300 } |
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1705 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1709 SiteInstance* instance) { | 1706 SiteInstance* instance) { |
1710 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1707 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1711 if (iter != proxy_hosts_.end()) { | 1708 if (iter != proxy_hosts_.end()) { |
1712 delete iter->second; | 1709 delete iter->second; |
1713 proxy_hosts_.erase(iter); | 1710 proxy_hosts_.erase(iter); |
1714 } | 1711 } |
1715 } | 1712 } |
1716 | 1713 |
1717 } // namespace content | 1714 } // namespace content |
OLD | NEW |