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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1613453002: Diagnose RenderFrameImpl::didCommitProvisionalLoad crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Limit SwapOut keys to main frame Created 4 years, 11 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
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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>
11 11
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/alias.h" 14 #include "base/debug/alias.h"
15 #include "base/debug/asan_invalid_access.h" 15 #include "base/debug/asan_invalid_access.h"
16 #include "base/debug/crash_logging.h"
16 #include "base/debug/dump_without_crashing.h" 17 #include "base/debug/dump_without_crashing.h"
17 #include "base/files/file.h" 18 #include "base/files/file.h"
18 #include "base/i18n/char_iterator.h" 19 #include "base/i18n/char_iterator.h"
19 #include "base/logging.h" 20 #include "base/logging.h"
20 #include "base/macros.h" 21 #include "base/macros.h"
21 #include "base/memory/shared_memory.h" 22 #include "base/memory/shared_memory.h"
22 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
23 #include "base/metrics/field_trial.h" 24 #include "base/metrics/field_trial.h"
24 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
25 #include "base/process/process.h" 26 #include "base/process/process.h"
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 1525
1525 // It is now safe to show modal dialogs again. 1526 // It is now safe to show modal dialogs again.
1526 // TODO(creis): Deal with modal dialogs from subframes. 1527 // TODO(creis): Deal with modal dialogs from subframes.
1527 if (is_main_frame_) 1528 if (is_main_frame_)
1528 render_view_->suppress_dialogs_until_swap_out_ = false; 1529 render_view_->suppress_dialogs_until_swap_out_ = false;
1529 1530
1530 Send(new FrameHostMsg_SwapOut_ACK(routing_id_)); 1531 Send(new FrameHostMsg_SwapOut_ACK(routing_id_));
1531 1532
1532 RenderViewImpl* render_view = render_view_.get(); 1533 RenderViewImpl* render_view = render_view_.get();
1533 bool is_main_frame = is_main_frame_; 1534 bool is_main_frame = is_main_frame_;
1535 int routing_id = GetRoutingID();
1534 1536
1535 // Now that all of the cleanup is complete and the browser side is notified, 1537 // Now that all of the cleanup is complete and the browser side is notified,
1536 // start using the RenderFrameProxy, if one is created. 1538 // start using the RenderFrameProxy, if one is created.
1537 if (proxy && swapped_out_forbidden) { 1539 if (proxy && swapped_out_forbidden) {
1538 // The swap call deletes this RenderFrame via frameDetached. Do not access 1540 // The swap call deletes this RenderFrame via frameDetached. Do not access
1539 // any members after this call. 1541 // any members after this call.
1540 // TODO(creis): WebFrame::swap() can return false. Most of those cases 1542 // TODO(creis): WebFrame::swap() can return false. Most of those cases
1541 // should be due to the frame being detached during unload (in which case 1543 // should be due to the frame being detached during unload (in which case
1542 // the necessary cleanup has happened anyway), but it might be possible for 1544 // the necessary cleanup has happened anyway), but it might be possible for
1543 // it to return false without detaching. Catch those cases below to track 1545 // it to return false without detaching. Catch those cases below to track
1544 // down https://crbug.com/575245. 1546 // down https://crbug.com/575245.
1545 frame_->swap(proxy->web_frame()); 1547 frame_->swap(proxy->web_frame());
1546 1548
1547 // For main frames, the swap should have cleared the RenderView's pointer to 1549 // For main frames, the swap should have cleared the RenderView's pointer to
1548 // this frame. 1550 // this frame.
1549 if (is_main_frame) 1551 if (is_main_frame) {
1552 base::debug::SetCrashKeyValue("swapout_frame_id",
1553 base::IntToString(routing_id));
1554 base::debug::SetCrashKeyValue("swapout_proxy_id",
1555 base::IntToString(proxy->routing_id()));
1556 base::debug::SetCrashKeyValue(
1557 "swapout_view_id", base::IntToString(render_view->GetRoutingID()));
1550 CHECK(!render_view->main_render_frame_); 1558 CHECK(!render_view->main_render_frame_);
1559 }
1551 1560
1552 if (is_loading) 1561 if (is_loading)
1553 proxy->OnDidStartLoading(); 1562 proxy->OnDidStartLoading();
1554 } 1563 }
1555 1564
1556 // In --site-per-process, initialize the WebRemoteFrame with the replication 1565 // In --site-per-process, initialize the WebRemoteFrame with the replication
1557 // state passed by the process that is now rendering the frame. 1566 // state passed by the process that is now rendering the frame.
1558 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because 1567 // TODO(alexmos): We cannot yet do this for swapped-out main frames, because
1559 // in that case we leave the LocalFrame as the main frame visible to Blink 1568 // in that case we leave the LocalFrame as the main frame visible to Blink
1560 // and don't call swap() above. Because swap() is what creates a RemoteFrame 1569 // and don't call swap() above. Because swap() is what creates a RemoteFrame
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 return; 3108 return;
3100 3109
3101 proxy->web_frame()->swap(frame_); 3110 proxy->web_frame()->swap(frame_);
3102 proxy_routing_id_ = MSG_ROUTING_NONE; 3111 proxy_routing_id_ = MSG_ROUTING_NONE;
3103 in_frame_tree_ = true; 3112 in_frame_tree_ = true;
3104 3113
3105 // If this is the main frame going from a remote frame to a local frame, 3114 // If this is the main frame going from a remote frame to a local frame,
3106 // it needs to set RenderViewImpl's pointer for the main frame to itself 3115 // it needs to set RenderViewImpl's pointer for the main frame to itself
3107 // and ensure RenderWidget is no longer in swapped out mode. 3116 // and ensure RenderWidget is no longer in swapped out mode.
3108 if (is_main_frame_) { 3117 if (is_main_frame_) {
3118 // Debug cases of https://crbug.com/575245.
3119 base::debug::SetCrashKeyValue("commit_frame_id",
3120 base::IntToString(GetRoutingID()));
3121 base::debug::SetCrashKeyValue("commit_proxy_id",
3122 base::IntToString(proxy->routing_id()));
nasko 2016/01/20 21:03:11 Wouldn't |proxy| be deleted by now? The swap() cal
Charlie Reis 2016/01/20 21:16:46 You're right! It's garbage here. Good catch.
3123 base::debug::SetCrashKeyValue(
3124 "commit_view_id", base::IntToString(render_view_->GetRoutingID()));
3125 if (render_view_->main_render_frame_) {
3126 base::debug::SetCrashKeyValue(
3127 "commit_main_render_frame_id",
3128 base::IntToString(
3129 render_view_->main_render_frame_->GetRoutingID()));
3130 }
3109 CHECK(!render_view_->main_render_frame_); 3131 CHECK(!render_view_->main_render_frame_);
3110 render_view_->main_render_frame_ = this; 3132 render_view_->main_render_frame_ = this;
3111 if (render_view_->is_swapped_out()) 3133 if (render_view_->is_swapped_out())
3112 render_view_->SetSwappedOut(false); 3134 render_view_->SetSwappedOut(false);
3113 } 3135 }
3114 } 3136 }
3115 3137
3116 // For new page navigations, the browser process needs to be notified of the 3138 // For new page navigations, the browser process needs to be notified of the
3117 // first paint of that page, so it can cancel the timer that waits for it. 3139 // first paint of that page, so it can cancel the timer that waits for it.
3118 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) { 3140 if (is_main_frame_ && !navigation_state->WasWithinSamePage()) {
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after
5772 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5794 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5773 scoped_refptr<media::AudioOutputDevice> device = 5795 scoped_refptr<media::AudioOutputDevice> device =
5774 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5796 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5775 security_origin); 5797 security_origin);
5776 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5798 media::OutputDeviceStatus status = device->GetDeviceStatus();
5777 device->Stop(); 5799 device->Stop();
5778 callback.Run(status); 5800 callback.Run(status);
5779 } 5801 }
5780 5802
5781 } // namespace content 5803 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698