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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 transfer_navigation_handle_ = | 451 transfer_navigation_handle_ = |
452 pending_render_frame_host->PassNavigationHandleOwnership(); | 452 pending_render_frame_host->PassNavigationHandleOwnership(); |
453 DCHECK(transfer_navigation_handle_); | 453 DCHECK(transfer_navigation_handle_); |
454 | 454 |
455 // Set the transferring RenderFrameHost as not loading, so that it does not | 455 // Set the transferring RenderFrameHost as not loading, so that it does not |
456 // emit a DidStopLoading notification if it is destroyed when creating the | 456 // emit a DidStopLoading notification if it is destroyed when creating the |
457 // new navigating RenderFrameHost. | 457 // new navigating RenderFrameHost. |
458 pending_render_frame_host->set_is_loading(false); | 458 pending_render_frame_host->set_is_loading(false); |
459 | 459 |
460 // Sanity check that the params are for the correct frame and process. | 460 // Sanity check that the params are for the correct frame and process. |
461 // These should match the RenderFrameHost that made the request. | 461 // These should match the RenderFrameHost that made the request. If it |
462 // If it started as a cross-process navigation via OpenURL, this is the | 462 // started as a cross-process navigation via OpenURL, this is the pending |
463 // pending one. If it wasn't cross-process until the transfer, this is | 463 // one. If it wasn't cross-process until the transfer, this is the current |
464 // the current one. | 464 // one. |
465 int render_frame_id = pending_render_frame_host_ | 465 // |
466 ? pending_render_frame_host_->GetRoutingID() | 466 // Note that having a pending RenderFrameHost does not imply that it was the |
467 : render_frame_host_->GetRoutingID(); | 467 // one that made the request. Suppose that during a pending cross-site |
468 DCHECK_EQ(render_frame_id, pending_render_frame_host->GetRoutingID()); | 468 // navigation, the frame performs a different same-site navigation which |
469 int process_id = pending_render_frame_host_ ? | 469 // redirects cross-site. In this case, there will be a pending |
470 // RenderFrameHost, but this request is made by the current RenderFrameHost. | |
471 // Later, this will create a new pending RenderFrameHost and clean up the old | |
472 // one. | |
473 int request_routing_id = pending_render_frame_host->GetRoutingID(); | |
474 int pending_routing_id = pending_render_frame_host_ ? | |
475 pending_render_frame_host_->GetRoutingID() : | |
476 MSG_ROUTING_NONE; | |
477 DCHECK(request_routing_id == pending_routing_id || | |
alexmos
2016/02/25 21:59:12
Relaxing this DCHECK was necessary to enable navig
Charlie Reis
2016/02/26 21:26:41
Yep. I wouldn't be opposed to landing this change
alexmos
2016/02/26 22:37:56
Agreed. I split this off into https://codereview.
| |
478 request_routing_id == render_frame_host_->GetRoutingID()); | |
479 int process_id = request_routing_id == pending_routing_id ? | |
470 pending_render_frame_host_->GetProcess()->GetID() : | 480 pending_render_frame_host_->GetProcess()->GetID() : |
471 render_frame_host_->GetProcess()->GetID(); | 481 render_frame_host_->GetProcess()->GetID(); |
472 DCHECK_EQ(process_id, global_request_id.child_id); | 482 DCHECK_EQ(process_id, global_request_id.child_id); |
473 | 483 |
474 // Treat the last URL in the chain as the destination and the remainder as | 484 // Treat the last URL in the chain as the destination and the remainder as |
475 // the redirect chain. | 485 // the redirect chain. |
476 CHECK(transfer_url_chain.size()); | 486 CHECK(transfer_url_chain.size()); |
477 GURL transfer_url = transfer_url_chain.back(); | 487 GURL transfer_url = transfer_url_chain.back(); |
478 std::vector<GURL> rest_of_chain = transfer_url_chain; | 488 std::vector<GURL> rest_of_chain = transfer_url_chain; |
479 rest_of_chain.pop_back(); | 489 rest_of_chain.pop_back(); |
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2509 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2519 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2510 if (!frame_tree_node_->opener()) | 2520 if (!frame_tree_node_->opener()) |
2511 return MSG_ROUTING_NONE; | 2521 return MSG_ROUTING_NONE; |
2512 | 2522 |
2513 return frame_tree_node_->opener() | 2523 return frame_tree_node_->opener() |
2514 ->render_manager() | 2524 ->render_manager() |
2515 ->GetRoutingIdForSiteInstance(instance); | 2525 ->GetRoutingIdForSiteInstance(instance); |
2516 } | 2526 } |
2517 | 2527 |
2518 } // namespace content | 2528 } // namespace content |
OLD | NEW |