Commit 02a177ef authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

Debugging code for crash in blink::Page::RequestBeginMainFrameNotExpected

There's a weird crash right now in RequestBeginMainFrameNotExpected. The
current theory is that somehow, Blink can't lookup the LocalFrame's
corresponding WebLocalFrame. Add some tracing info to try to figure out
how this is happening.

Bug: 838348
Change-Id: Icbc357fcbb278e309d8b99a03cc652f9b9ccd771
Reviewed-on: https://chromium-review.googlesource.com/1041150Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555659}
parent efd04ffb
...@@ -75,6 +75,7 @@ void Frame::Trace(blink::Visitor* visitor) { ...@@ -75,6 +75,7 @@ void Frame::Trace(blink::Visitor* visitor) {
void Frame::Detach(FrameDetachType type) { void Frame::Detach(FrameDetachType type) {
DCHECK(client_); DCHECK(client_);
detach_stack_ = base::debug::StackTrace();
// By the time this method is called, the subclasses should have already // By the time this method is called, the subclasses should have already
// advanced to the Detaching state. // advanced to the Detaching state.
DCHECK_EQ(lifecycle_.GetState(), FrameLifecycle::kDetaching); DCHECK_EQ(lifecycle_.GetState(), FrameLifecycle::kDetaching);
...@@ -279,7 +280,8 @@ Frame::Frame(FrameClient* client, ...@@ -279,7 +280,8 @@ Frame::Frame(FrameClient* client,
client_(client), client_(client),
window_proxy_manager_(window_proxy_manager), window_proxy_manager_(window_proxy_manager),
is_loading_(false), is_loading_(false),
devtools_frame_token_(client->GetDevToolsFrameToken()) { devtools_frame_token_(client->GetDevToolsFrameToken()),
create_stack_(base::debug::StackTrace()) {
InstanceCounters::IncrementCounter(InstanceCounters::kFrameCounter); InstanceCounters::IncrementCounter(InstanceCounters::kFrameCounter);
if (owner_) if (owner_)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FRAME_H_
#include "base/debug/stack_trace.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h"
...@@ -218,6 +219,14 @@ class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> { ...@@ -218,6 +219,14 @@ class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> {
} }
const CString& ToTraceValue(); const CString& ToTraceValue();
// TODO(dcheng): temporary for debugging https://crbug.com/838348.
const base::debug::StackTrace& CreateStackForDebugging() {
return create_stack_;
}
const base::debug::StackTrace& DetachStackForDebugging() {
return detach_stack_;
}
protected: protected:
Frame(FrameClient*, Page&, FrameOwner*, WindowProxyManager*); Frame(FrameClient*, Page&, FrameOwner*, WindowProxyManager*);
...@@ -262,6 +271,9 @@ class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> { ...@@ -262,6 +271,9 @@ class CORE_EXPORT Frame : public GarbageCollectedFinalized<Frame> {
bool is_loading_; bool is_loading_;
base::UnguessableToken devtools_frame_token_; base::UnguessableToken devtools_frame_token_;
base::Optional<CString> trace_value_; base::Optional<CString> trace_value_;
base::debug::StackTrace create_stack_;
base::debug::StackTrace detach_stack_;
}; };
inline FrameClient* Frame::Client() const { inline FrameClient* Frame::Client() const {
......
...@@ -2537,6 +2537,7 @@ void WebLocalFrameImpl::SetSpellCheckPanelHostClient( ...@@ -2537,6 +2537,7 @@ void WebLocalFrameImpl::SetSpellCheckPanelHostClient(
} }
WebFrameWidgetBase* WebLocalFrameImpl::LocalRootFrameWidget() { WebFrameWidgetBase* WebLocalFrameImpl::LocalRootFrameWidget() {
CHECK(LocalRoot());
return LocalRoot()->FrameWidgetImpl(); return LocalRoot()->FrameWidgetImpl();
} }
......
...@@ -831,7 +831,9 @@ bool ChromeClientImpl::ShouldOpenModalDialogDuringPageDismissal( ...@@ -831,7 +831,9 @@ bool ChromeClientImpl::ShouldOpenModalDialogDuringPageDismissal(
} }
WebLayerTreeView* ChromeClientImpl::GetWebLayerTreeView(LocalFrame* frame) { WebLayerTreeView* ChromeClientImpl::GetWebLayerTreeView(LocalFrame* frame) {
CHECK(frame);
WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame); WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame);
CHECK(web_frame);
if (WebFrameWidgetBase* frame_widget = web_frame->LocalRootFrameWidget()) if (WebFrameWidgetBase* frame_widget = web_frame->LocalRootFrameWidget())
return frame_widget->GetLayerTreeView(); return frame_widget->GetLayerTreeView();
return nullptr; return nullptr;
......
...@@ -810,6 +810,13 @@ void Page::RequestBeginMainFrameNotExpected(bool new_state) { ...@@ -810,6 +810,13 @@ void Page::RequestBeginMainFrameNotExpected(bool new_state) {
if (!main_frame_ || !main_frame_->IsLocalFrame()) if (!main_frame_ || !main_frame_->IsLocalFrame())
return; return;
base::debug::StackTrace main_frame_created_trace =
main_frame_->CreateStackForDebugging();
base::debug::Alias(&main_frame_created_trace);
base::debug::StackTrace main_frame_detached_trace =
main_frame_->DetachStackForDebugging();
base::debug::Alias(&main_frame_detached_trace);
CHECK(main_frame_->IsAttached());
if (LocalFrame* main_frame = DeprecatedLocalMainFrame()) { if (LocalFrame* main_frame = DeprecatedLocalMainFrame()) {
if (WebLayerTreeView* layer_tree_view = if (WebLayerTreeView* layer_tree_view =
chrome_client_->GetWebLayerTreeView(main_frame)) { chrome_client_->GetWebLayerTreeView(main_frame)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment