| 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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 // start using the RenderFrameProxy. | 1769 // start using the RenderFrameProxy. |
| 1770 // | 1770 // |
| 1771 // The swap call deletes this RenderFrame via frameDetached. Do not access | 1771 // The swap call deletes this RenderFrame via frameDetached. Do not access |
| 1772 // any members after this call. | 1772 // any members after this call. |
| 1773 // | 1773 // |
| 1774 // TODO(creis): WebFrame::swap() can return false. Most of those cases | 1774 // TODO(creis): WebFrame::swap() can return false. Most of those cases |
| 1775 // should be due to the frame being detached during unload (in which case | 1775 // should be due to the frame being detached during unload (in which case |
| 1776 // the necessary cleanup has happened anyway), but it might be possible for | 1776 // the necessary cleanup has happened anyway), but it might be possible for |
| 1777 // it to return false without detaching. Catch any cases that the | 1777 // it to return false without detaching. Catch any cases that the |
| 1778 // RenderView's main_render_frame_ isn't cleared below (whether swap returns | 1778 // RenderView's main_render_frame_ isn't cleared below (whether swap returns |
| 1779 // false or not), to track down https://crbug.com/575245. | 1779 // false or not). |
| 1780 bool success = frame_->Swap(proxy->web_frame()); | 1780 bool success = frame_->Swap(proxy->web_frame()); |
| 1781 | 1781 |
| 1782 // For main frames, the swap should have cleared the RenderView's pointer to | 1782 // For main frames, the swap should have cleared the RenderView's pointer to |
| 1783 // this frame. | 1783 // this frame. |
| 1784 if (is_main_frame) { | 1784 if (is_main_frame) |
| 1785 base::debug::SetCrashKeyValue("swapout_frame_id", | |
| 1786 base::IntToString(routing_id)); | |
| 1787 base::debug::SetCrashKeyValue("swapout_proxy_id", | |
| 1788 base::IntToString(proxy->routing_id())); | |
| 1789 base::debug::SetCrashKeyValue( | |
| 1790 "swapout_view_id", base::IntToString(render_view->GetRoutingID())); | |
| 1791 CHECK(!render_view->main_render_frame_); | 1785 CHECK(!render_view->main_render_frame_); |
| 1792 } | |
| 1793 | 1786 |
| 1794 if (!success) { | 1787 if (!success) { |
| 1795 // The swap can fail when the frame is detached during swap (this can | 1788 // The swap can fail when the frame is detached during swap (this can |
| 1796 // happen while running the unload handlers). When that happens, delete | 1789 // happen while running the unload handlers). When that happens, delete |
| 1797 // the proxy. | 1790 // the proxy. |
| 1798 proxy->FrameDetached(blink::WebRemoteFrameClient::DetachType::kSwap); | 1791 proxy->FrameDetached(blink::WebRemoteFrameClient::DetachType::kSwap); |
| 1799 return; | 1792 return; |
| 1800 } | 1793 } |
| 1801 | 1794 |
| 1802 if (is_loading) | 1795 if (is_loading) |
| (...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5163 // LocalFrame was being navigated, the provisional frame would've been | 5156 // LocalFrame was being navigated, the provisional frame would've been |
| 5164 // cleaned up by RenderFrameProxy::frameDetached. See | 5157 // cleaned up by RenderFrameProxy::frameDetached. See |
| 5165 // https://crbug.com/526304 and https://crbug.com/568676 for context. | 5158 // https://crbug.com/526304 and https://crbug.com/568676 for context. |
| 5166 RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); | 5159 RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id_); |
| 5167 CHECK(proxy); | 5160 CHECK(proxy); |
| 5168 | 5161 |
| 5169 unique_name_helper_.set_propagated_name(proxy->unique_name()); | 5162 unique_name_helper_.set_propagated_name(proxy->unique_name()); |
| 5170 | 5163 |
| 5171 // Note: Calling swap() will detach and delete |proxy|, so do not reference it | 5164 // Note: Calling swap() will detach and delete |proxy|, so do not reference it |
| 5172 // after this. | 5165 // after this. |
| 5173 int proxy_routing_id = proxy_routing_id_; | |
| 5174 if (!proxy->web_frame()->Swap(frame_)) | 5166 if (!proxy->web_frame()->Swap(frame_)) |
| 5175 return false; | 5167 return false; |
| 5176 | 5168 |
| 5177 proxy_routing_id_ = MSG_ROUTING_NONE; | 5169 proxy_routing_id_ = MSG_ROUTING_NONE; |
| 5178 in_frame_tree_ = true; | 5170 in_frame_tree_ = true; |
| 5179 | 5171 |
| 5180 // If this is the main frame going from a remote frame to a local frame, | 5172 // If this is the main frame going from a remote frame to a local frame, |
| 5181 // it needs to set RenderViewImpl's pointer for the main frame to itself | 5173 // it needs to set RenderViewImpl's pointer for the main frame to itself |
| 5182 // and ensure RenderWidget is no longer in swapped out mode. | 5174 // and ensure RenderWidget is no longer in swapped out mode. |
| 5183 if (is_main_frame_) { | 5175 if (is_main_frame_) { |
| 5184 // Debug cases of https://crbug.com/575245. | |
| 5185 base::debug::SetCrashKeyValue("commit_frame_id", | |
| 5186 base::IntToString(GetRoutingID())); | |
| 5187 base::debug::SetCrashKeyValue("commit_proxy_id", | |
| 5188 base::IntToString(proxy_routing_id)); | |
| 5189 base::debug::SetCrashKeyValue( | |
| 5190 "commit_view_id", base::IntToString(render_view_->GetRoutingID())); | |
| 5191 if (render_view_->main_render_frame_) { | |
| 5192 base::debug::SetCrashKeyValue( | |
| 5193 "commit_main_render_frame_id", | |
| 5194 base::IntToString(render_view_->main_render_frame_->GetRoutingID())); | |
| 5195 } | |
| 5196 CHECK(!render_view_->main_render_frame_); | 5176 CHECK(!render_view_->main_render_frame_); |
| 5197 render_view_->main_render_frame_ = this; | 5177 render_view_->main_render_frame_ = this; |
| 5198 if (render_view_->is_swapped_out()) | 5178 if (render_view_->is_swapped_out()) |
| 5199 render_view_->SetSwappedOut(false); | 5179 render_view_->SetSwappedOut(false); |
| 5200 } | 5180 } |
| 5201 | 5181 |
| 5202 return true; | 5182 return true; |
| 5203 } | 5183 } |
| 5204 | 5184 |
| 5205 void RenderFrameImpl::DidStartLoading(bool to_different_document) { | 5185 void RenderFrameImpl::DidStartLoading(bool to_different_document) { |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7096 policy(info.default_policy), | 7076 policy(info.default_policy), |
| 7097 replaces_current_history_item(info.replaces_current_history_item), | 7077 replaces_current_history_item(info.replaces_current_history_item), |
| 7098 history_navigation_in_new_child_frame( | 7078 history_navigation_in_new_child_frame( |
| 7099 info.is_history_navigation_in_new_child_frame), | 7079 info.is_history_navigation_in_new_child_frame), |
| 7100 client_redirect(info.is_client_redirect), | 7080 client_redirect(info.is_client_redirect), |
| 7101 cache_disabled(info.is_cache_disabled), | 7081 cache_disabled(info.is_cache_disabled), |
| 7102 form(info.form), | 7082 form(info.form), |
| 7103 source_location(info.source_location) {} | 7083 source_location(info.source_location) {} |
| 7104 | 7084 |
| 7105 } // namespace content | 7085 } // namespace content |
| OLD | NEW |