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