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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 // start using the RenderFrameProxy. | 1767 // start using the RenderFrameProxy. |
1768 // | 1768 // |
1769 // The swap call deletes this RenderFrame via frameDetached. Do not access | 1769 // The swap call deletes this RenderFrame via frameDetached. Do not access |
1770 // any members after this call. | 1770 // any members after this call. |
1771 // | 1771 // |
1772 // TODO(creis): WebFrame::swap() can return false. Most of those cases | 1772 // TODO(creis): WebFrame::swap() can return false. Most of those cases |
1773 // should be due to the frame being detached during unload (in which case | 1773 // should be due to the frame being detached during unload (in which case |
1774 // the necessary cleanup has happened anyway), but it might be possible for | 1774 // the necessary cleanup has happened anyway), but it might be possible for |
1775 // it to return false without detaching. Catch any cases that the | 1775 // it to return false without detaching. Catch any cases that the |
1776 // RenderView's main_render_frame_ isn't cleared below (whether swap returns | 1776 // RenderView's main_render_frame_ isn't cleared below (whether swap returns |
1777 // false or not), to track down https://crbug.com/575245. | 1777 // false or not). |
1778 bool success = frame_->Swap(proxy->web_frame()); | 1778 bool success = frame_->Swap(proxy->web_frame()); |
1779 | 1779 |
1780 // For main frames, the swap should have cleared the RenderView's pointer to | 1780 // For main frames, the swap should have cleared the RenderView's pointer to |
1781 // this frame. | 1781 // this frame. |
1782 if (is_main_frame) { | 1782 if (is_main_frame) |
1783 base::debug::SetCrashKeyValue("swapout_frame_id", | |
1784 base::IntToString(routing_id)); | |
1785 base::debug::SetCrashKeyValue("swapout_proxy_id", | |
1786 base::IntToString(proxy->routing_id())); | |
1787 base::debug::SetCrashKeyValue( | |
1788 "swapout_view_id", base::IntToString(render_view->GetRoutingID())); | |
1789 CHECK(!render_view->main_render_frame_); | 1783 CHECK(!render_view->main_render_frame_); |
1790 } | |
1791 | 1784 |
1792 if (!success) { | 1785 if (!success) { |
1793 // The swap can fail when the frame is detached during swap (this can | 1786 // The swap can fail when the frame is detached during swap (this can |
1794 // happen while running the unload handlers). When that happens, delete | 1787 // happen while running the unload handlers). When that happens, delete |
1795 // the proxy. | 1788 // the proxy. |
1796 proxy->FrameDetached(blink::WebRemoteFrameClient::DetachType::kSwap); | 1789 proxy->FrameDetached(blink::WebRemoteFrameClient::DetachType::kSwap); |
1797 return; | 1790 return; |
1798 } | 1791 } |
1799 | 1792 |
1800 if (is_loading) | 1793 if (is_loading) |
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5135 // LocalFrame was being navigated, the provisional frame would've been | 5128 // LocalFrame was being navigated, the provisional frame would've been |
5136 // cleaned up by RenderFrameProxy::frameDetached. See | 5129 // cleaned up by RenderFrameProxy::frameDetached. See |
5137 // https://crbug.com/526304 and https://crbug.com/568676 for context. | 5130 // https://crbug.com/526304 and https://crbug.com/568676 for context. |
5138 RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); | 5131 RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); |
5139 CHECK(proxy); | 5132 CHECK(proxy); |
5140 | 5133 |
5141 unique_name_helper_.set_propagated_name(proxy->unique_name()); | 5134 unique_name_helper_.set_propagated_name(proxy->unique_name()); |
5142 | 5135 |
5143 // Note: Calling swap() will detach and delete |proxy|, so do not reference it | 5136 // Note: Calling swap() will detach and delete |proxy|, so do not reference it |
5144 // after this. | 5137 // after this. |
5145 int proxy_routing_id = proxy_routing_id_; | |
5146 if (!proxy->web_frame()->Swap(frame_)) | 5138 if (!proxy->web_frame()->Swap(frame_)) |
5147 return false; | 5139 return false; |
5148 | 5140 |
5149 proxy_routing_id_ = MSG_ROUTING_NONE; | 5141 proxy_routing_id_ = MSG_ROUTING_NONE; |
5150 in_frame_tree_ = true; | 5142 in_frame_tree_ = true; |
5151 | 5143 |
5152 // If this is the main frame going from a remote frame to a local frame, | 5144 // If this is the main frame going from a remote frame to a local frame, |
5153 // it needs to set RenderViewImpl's pointer for the main frame to itself | 5145 // it needs to set RenderViewImpl's pointer for the main frame to itself |
5154 // and ensure RenderWidget is no longer in swapped out mode. | 5146 // and ensure RenderWidget is no longer in swapped out mode. |
5155 if (is_main_frame_) { | 5147 if (is_main_frame_) { |
5156 // Debug cases of https://crbug.com/575245. | |
5157 base::debug::SetCrashKeyValue("commit_frame_id", | |
5158 base::IntToString(GetRoutingID())); | |
5159 base::debug::SetCrashKeyValue("commit_proxy_id", | |
5160 base::IntToString(proxy_routing_id)); | |
5161 base::debug::SetCrashKeyValue( | |
5162 "commit_view_id", base::IntToString(render_view_->GetRoutingID())); | |
5163 if (render_view_->main_render_frame_) { | |
5164 base::debug::SetCrashKeyValue( | |
5165 "commit_main_render_frame_id", | |
Charlie Reis
2017/05/09 16:42:26
I don't see any instances of this crash key value
alexmos
2017/05/09 21:26:55
Acknowledged.
| |
5166 base::IntToString(render_view_->main_render_frame_->GetRoutingID())); | |
5167 } | |
5168 CHECK(!render_view_->main_render_frame_); | 5148 CHECK(!render_view_->main_render_frame_); |
5169 render_view_->main_render_frame_ = this; | 5149 render_view_->main_render_frame_ = this; |
5170 if (render_view_->is_swapped_out()) | 5150 if (render_view_->is_swapped_out()) |
5171 render_view_->SetSwappedOut(false); | 5151 render_view_->SetSwappedOut(false); |
5172 } | 5152 } |
5173 | 5153 |
5174 return true; | 5154 return true; |
5175 } | 5155 } |
5176 | 5156 |
5177 void RenderFrameImpl::DidStartLoading(bool to_different_document) { | 5157 void RenderFrameImpl::DidStartLoading(bool to_different_document) { |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7039 policy(info.default_policy), | 7019 policy(info.default_policy), |
7040 replaces_current_history_item(info.replaces_current_history_item), | 7020 replaces_current_history_item(info.replaces_current_history_item), |
7041 history_navigation_in_new_child_frame( | 7021 history_navigation_in_new_child_frame( |
7042 info.is_history_navigation_in_new_child_frame), | 7022 info.is_history_navigation_in_new_child_frame), |
7043 client_redirect(info.is_client_redirect), | 7023 client_redirect(info.is_client_redirect), |
7044 cache_disabled(info.is_cache_disabled), | 7024 cache_disabled(info.is_cache_disabled), |
7045 form(info.form), | 7025 form(info.form), |
7046 source_location(info.source_location) {} | 7026 source_location(info.source_location) {} |
7047 | 7027 |
7048 } // namespace content | 7028 } // namespace content |
OLD | NEW |