Commit e3488a95 authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

aw: Unsubscribe from BeginFrameSource

During destruction of WebView it's possible that not every observer has
unsubscribed from BeginFrameSource in RootFrameSink (the latest it will
happen in dtor RootFrameSink). This leads to situation when
RootFrameSinkProxy is still observing BrowserViewRenderer's
BeginFrameSource in dtor which leads to DCHECKs.

This CL adds explicit RemoveObserver in RootFrameSinkProxy dtor to
handle sutiation correctly.

Bug: 1054777
Change-Id: I00811c79ae430872964075c83a308cad17a8694a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067087Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743567}
parent 6453bece
......@@ -70,6 +70,8 @@ RootFrameSinkProxy::~RootFrameSinkProxy() {
VizCompositorThreadRunnerWebView::GetInstance()->PostTaskAndBlock(
FROM_HERE, base::BindOnce(&RootFrameSinkProxy::DestroyOnViz,
base::Unretained(this)));
if (observing_bfs_)
begin_frame_source_->RemoveObserver(this);
}
void RootFrameSinkProxy::DestroyOnViz() {
......@@ -90,6 +92,11 @@ void RootFrameSinkProxy::SetNeedsBeginFramesOnViz(bool needs_begin_frames) {
void RootFrameSinkProxy::SetNeedsBeginFramesOnUI(bool needs_begin_frames) {
DCHECK_CALLED_ON_VALID_THREAD(ui_thread_checker_);
if (observing_bfs_ == needs_begin_frames)
return;
observing_bfs_ = needs_begin_frames;
if (needs_begin_frames)
begin_frame_source_->AddObserver(this);
else
......
......@@ -79,6 +79,7 @@ class RootFrameSinkProxy : public viz::BeginFrameObserverBase {
scoped_refptr<RootFrameSink> without_gpu_;
viz::BeginFrameSource* const begin_frame_source_;
bool had_input_event_ = false;
bool observing_bfs_ = false;
THREAD_CHECKER(ui_thread_checker_);
THREAD_CHECKER(viz_thread_checker_);
......
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