Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1835833002: Fix 3 crashes related to navigations after a process dies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lots of cleanup Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 // reset. 1321 // reset.
1322 SetRenderFrameCreated(false); 1322 SetRenderFrameCreated(false);
1323 InvalidateMojoConnection(); 1323 InvalidateMojoConnection();
1324 1324
1325 // Execute any pending AX tree snapshot callbacks with an empty response, 1325 // Execute any pending AX tree snapshot callbacks with an empty response,
1326 // since we're never going to get a response from this renderer. 1326 // since we're never going to get a response from this renderer.
1327 for (const auto& iter : ax_tree_snapshot_callbacks_) 1327 for (const auto& iter : ax_tree_snapshot_callbacks_)
1328 iter.second.Run(ui::AXTreeUpdate()); 1328 iter.second.Run(ui::AXTreeUpdate());
1329 ax_tree_snapshot_callbacks_.clear(); 1329 ax_tree_snapshot_callbacks_.clear();
1330 1330
1331 // If the process has died, we don't need to wait for the swap out ack from
1332 // this RenderFrame if it is pending deletion. Complete the swap out to
1333 // destroy it.
1334 if (frame_tree_node_->render_manager()->IsPendingDeletion(this))
1335 OnSwappedOut();
Charlie Reis 2016/03/28 19:06:37 This is a separate fix for CreateRenderView (58191
alexmos 2016/03/29 18:43:01 Acknowledged.
1336
1331 // Note: don't add any more code at this point in the function because 1337 // Note: don't add any more code at this point in the function because
1332 // |this| may be deleted. Any additional cleanup should happen before 1338 // |this| may be deleted. Any additional cleanup should happen before
1333 // the last block of code here. 1339 // the last block of code here.
1334 } 1340 }
1335 1341
1336 void RenderFrameHostImpl::OnSwappedOut() { 1342 void RenderFrameHostImpl::OnSwappedOut() {
1337 // Ignore spurious swap out ack. 1343 // Ignore spurious swap out ack.
1338 if (rfh_state_ != STATE_PENDING_SWAP_OUT) 1344 if (rfh_state_ != STATE_PENDING_SWAP_OUT)
1339 return; 1345 return;
1340 1346
1341 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); 1347 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this);
1342 swapout_event_monitor_timeout_->Stop(); 1348 swapout_event_monitor_timeout_->Stop();
1343 1349
1344 ClearAllWebUI(); 1350 ClearAllWebUI();
1345 1351
1346 // If this is a main frame RFH that's about to be deleted, update its RVH's 1352 // If this is a main frame RFH that's about to be deleted, update its RVH's
1347 // swapped-out state here, since SetState won't be called once this RFH is 1353 // swapped-out state here, since SetState won't be called once this RFH is
1348 // deleted below. https://crbug.com/505887 1354 // deleted below. https://crbug.com/505887
1349 if (frame_tree_node_->IsMainFrame() && 1355 if (frame_tree_node_->IsMainFrame() &&
1350 frame_tree_node_->render_manager()->IsPendingDeletion(this)) { 1356 frame_tree_node_->render_manager()->IsPendingDeletion(this)) {
1351 render_view_host_->set_is_active(false); 1357 render_view_host_->set_is_active(false);
1352 render_view_host_->set_is_swapped_out(true); 1358 render_view_host_->set_is_swapped_out(true);
1353 } 1359 }
1354 1360
1355 bool deleted = 1361 bool deleted =
1356 frame_tree_node_->render_manager()->DeleteFromPendingList(this); 1362 frame_tree_node_->render_manager()->DeleteFromPendingList(this);
1357 CHECK(deleted); 1363 CHECK(deleted);
1358 } 1364 }
1359 1365
1366 void RenderFrameHostImpl::ResetSwapOutTimerForTesting() {
1367 swapout_event_monitor_timeout_->Stop();
1368 }
1369
1360 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) { 1370 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) {
1361 // Validate the URLs in |params|. If the renderer can't request the URLs 1371 // Validate the URLs in |params|. If the renderer can't request the URLs
1362 // directly, don't show them in the context menu. 1372 // directly, don't show them in the context menu.
1363 ContextMenuParams validated_params(params); 1373 ContextMenuParams validated_params(params);
1364 RenderProcessHost* process = GetProcess(); 1374 RenderProcessHost* process = GetProcess();
1365 1375
1366 // We don't validate |unfiltered_link_url| so that this field can be used 1376 // We don't validate |unfiltered_link_url| so that this field can be used
1367 // when users want to copy the original link URL. 1377 // when users want to copy the original link URL.
1368 process->FilterURL(true, &validated_params.link_url); 1378 process->FilterURL(true, &validated_params.link_url);
1369 process->FilterURL(true, &validated_params.src_url); 1379 process->FilterURL(true, &validated_params.src_url);
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2707 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2698 if (!focused_frame_tree_node) 2708 if (!focused_frame_tree_node)
2699 return; 2709 return;
2700 RenderFrameHostImpl* focused_frame = 2710 RenderFrameHostImpl* focused_frame =
2701 focused_frame_tree_node->current_frame_host(); 2711 focused_frame_tree_node->current_frame_host();
2702 DCHECK(focused_frame); 2712 DCHECK(focused_frame);
2703 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2713 dst->focused_tree_id = focused_frame->GetAXTreeID();
2704 } 2714 }
2705 2715
2706 } // namespace content 2716 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698