| 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_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 bool RenderFrameHostImpl::IsRenderFrameLive() { | 652 bool RenderFrameHostImpl::IsRenderFrameLive() { |
| 653 bool is_live = GetProcess()->HasConnection() && render_frame_created_; | 653 bool is_live = GetProcess()->HasConnection() && render_frame_created_; |
| 654 | 654 |
| 655 // If the process is for an isolated guest (e.g. <webview>), rely on the | 655 // If the process is for an isolated guest (e.g. <webview>), rely on the |
| 656 // RenderViewHost liveness check. Once https://crbug.com/492830 is fixed, | 656 // RenderViewHost liveness check. Once https://crbug.com/492830 is fixed, |
| 657 // this can be removed. | 657 // this can be removed. |
| 658 if (GetProcess()->IsIsolatedGuest()) | 658 if (GetProcess()->IsIsolatedGuest()) |
| 659 is_live = render_view_host_->IsRenderViewLive(); | 659 is_live = render_view_host_->IsRenderViewLive(); |
| 660 | 660 |
| 661 // Sanity check: the RenderView should always be live if the RenderFrame is. | 661 // Sanity check: the RenderView should always be live if the RenderFrame is. |
| 662 DCHECK(!is_live || render_view_host_->IsRenderViewLive()); | 662 DCHECK_IMPLIES(is_live, render_view_host_->IsRenderViewLive()); |
| 663 | 663 |
| 664 return is_live; | 664 return is_live; |
| 665 } | 665 } |
| 666 | 666 |
| 667 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) { | 667 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) { |
| 668 bool was_created = render_frame_created_; | 668 bool was_created = render_frame_created_; |
| 669 render_frame_created_ = created; | 669 render_frame_created_ = created; |
| 670 | 670 |
| 671 // If the current status is different than the new status, the delegate | 671 // If the current status is different than the new status, the delegate |
| 672 // needs to be notified. | 672 // needs to be notified. |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 // reset. | 1105 // reset. |
| 1106 SetRenderFrameCreated(false); | 1106 SetRenderFrameCreated(false); |
| 1107 InvalidateMojoConnection(); | 1107 InvalidateMojoConnection(); |
| 1108 | 1108 |
| 1109 // Execute any pending AX tree snapshot callbacks with an empty response, | 1109 // Execute any pending AX tree snapshot callbacks with an empty response, |
| 1110 // since we're never going to get a response from this renderer. | 1110 // since we're never going to get a response from this renderer. |
| 1111 for (const auto& iter : ax_tree_snapshot_callbacks_) | 1111 for (const auto& iter : ax_tree_snapshot_callbacks_) |
| 1112 iter.second.Run(ui::AXTreeUpdate()); | 1112 iter.second.Run(ui::AXTreeUpdate()); |
| 1113 ax_tree_snapshot_callbacks_.clear(); | 1113 ax_tree_snapshot_callbacks_.clear(); |
| 1114 | 1114 |
| 1115 if (frame_tree_node_->IsMainFrame()) { | |
| 1116 // RenderViewHost/RenderWidgetHost needs to reset some stuff. | |
| 1117 render_view_host_->RendererExited( | |
| 1118 render_view_host_->render_view_termination_status_, exit_code); | |
| 1119 | |
| 1120 render_view_host_->delegate_->RenderViewTerminated( | |
| 1121 render_view_host_, static_cast<base::TerminationStatus>(status), | |
| 1122 exit_code); | |
| 1123 } | |
| 1124 | |
| 1125 // Note: don't add any more code at this point in the function because | 1115 // Note: don't add any more code at this point in the function because |
| 1126 // |this| may be deleted. Any additional cleanup should happen before | 1116 // |this| may be deleted. Any additional cleanup should happen before |
| 1127 // the last block of code here. | 1117 // the last block of code here. |
| 1128 } | 1118 } |
| 1129 | 1119 |
| 1130 void RenderFrameHostImpl::OnSwappedOut() { | 1120 void RenderFrameHostImpl::OnSwappedOut() { |
| 1131 // Ignore spurious swap out ack. | 1121 // Ignore spurious swap out ack. |
| 1132 if (rfh_state_ != STATE_PENDING_SWAP_OUT) | 1122 if (rfh_state_ != STATE_PENDING_SWAP_OUT) |
| 1133 return; | 1123 return; |
| 1134 | 1124 |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 // We may be returning to an existing NavigationEntry that had been granted | 2067 // We may be returning to an existing NavigationEntry that had been granted |
| 2078 // file access. If this is a different process, we will need to grant the | 2068 // file access. If this is a different process, we will need to grant the |
| 2079 // access again. The files listed in the page state are validated when they | 2069 // access again. The files listed in the page state are validated when they |
| 2080 // are received from the renderer to prevent abuse. | 2070 // are received from the renderer to prevent abuse. |
| 2081 if (request_params.page_state.IsValid()) { | 2071 if (request_params.page_state.IsValid()) { |
| 2082 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); | 2072 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); |
| 2083 } | 2073 } |
| 2084 } | 2074 } |
| 2085 | 2075 |
| 2086 } // namespace content | 2076 } // namespace content |
| OLD | NEW |