osr: Fix GPU process crash with SendExternalBeginFrame (see issue #2800)
Fixes the following error: Check failed: !pending_frame_callback_. Got overlapping IssueExternalBeginFrame To test: Run `cefclient --off-screen-rendering-enabled --external-begin-frame-enabled` on Windows without crashing.
This commit is contained in:
parent
7f52c30723
commit
4a28bcd532
|
@ -910,7 +910,10 @@ void CefRenderWidgetHostViewOSR::DidNavigate() {
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::OnFrameComplete(
|
void CefRenderWidgetHostViewOSR::OnFrameComplete(
|
||||||
const viz::BeginFrameAck& ack) {
|
const viz::BeginFrameAck& ack) {
|
||||||
// TODO(cef): is there something we need to track with this notification?
|
DCHECK(begin_frame_pending_);
|
||||||
|
DCHECK_EQ(begin_frame_source_.source_id(), ack.frame_id.source_id);
|
||||||
|
DCHECK_EQ(begin_frame_number_, ack.frame_id.sequence_number);
|
||||||
|
begin_frame_pending_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation(
|
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation(
|
||||||
|
@ -1047,17 +1050,20 @@ void CefRenderWidgetHostViewOSR::Invalidate(
|
||||||
void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||||
DCHECK(external_begin_frame_enabled_);
|
DCHECK(external_begin_frame_enabled_);
|
||||||
|
|
||||||
|
if (begin_frame_pending_)
|
||||||
|
return;
|
||||||
|
begin_frame_pending_ = true;
|
||||||
|
|
||||||
base::TimeTicks frame_time = base::TimeTicks::Now();
|
base::TimeTicks frame_time = base::TimeTicks::Now();
|
||||||
base::TimeTicks deadline = base::TimeTicks();
|
base::TimeTicks deadline = base::TimeTicks();
|
||||||
base::TimeDelta interval = viz::BeginFrameArgs::DefaultInterval();
|
base::TimeDelta interval = viz::BeginFrameArgs::DefaultInterval();
|
||||||
|
|
||||||
viz::BeginFrameArgs begin_frame_args = viz::BeginFrameArgs::Create(
|
viz::BeginFrameArgs begin_frame_args = viz::BeginFrameArgs::Create(
|
||||||
BEGINFRAME_FROM_HERE, begin_frame_source_.source_id(),
|
BEGINFRAME_FROM_HERE, begin_frame_source_.source_id(),
|
||||||
begin_frame_number_, frame_time, deadline, interval,
|
++begin_frame_number_, frame_time, deadline, interval,
|
||||||
viz::BeginFrameArgs::NORMAL);
|
viz::BeginFrameArgs::NORMAL);
|
||||||
|
|
||||||
DCHECK(begin_frame_args.IsValid());
|
DCHECK(begin_frame_args.IsValid());
|
||||||
begin_frame_number_++;
|
|
||||||
|
|
||||||
if (render_widget_host_)
|
if (render_widget_host_)
|
||||||
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
||||||
|
@ -1067,6 +1073,8 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||||
begin_frame_args, /* force= */ true,
|
begin_frame_args, /* force= */ true,
|
||||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||||
weak_ptr_factory_.GetWeakPtr()));
|
weak_ptr_factory_.GetWeakPtr()));
|
||||||
|
} else {
|
||||||
|
begin_frame_pending_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPopupWidget() && popup_host_view_) {
|
if (!IsPopupWidget() && popup_host_view_) {
|
||||||
|
|
|
@ -355,6 +355,7 @@ class CefRenderWidgetHostViewOSR
|
||||||
// Provides |source_id| for BeginFrameArgs that we create.
|
// Provides |source_id| for BeginFrameArgs that we create.
|
||||||
viz::StubBeginFrameSource begin_frame_source_;
|
viz::StubBeginFrameSource begin_frame_source_;
|
||||||
uint64_t begin_frame_number_ = viz::BeginFrameArgs::kStartingFrameNumber;
|
uint64_t begin_frame_number_ = viz::BeginFrameArgs::kStartingFrameNumber;
|
||||||
|
bool begin_frame_pending_ = false;
|
||||||
|
|
||||||
bool sync_frame_rate_ = false;
|
bool sync_frame_rate_ = false;
|
||||||
bool external_begin_frame_enabled_ = false;
|
bool external_begin_frame_enabled_ = false;
|
||||||
|
|
Loading…
Reference in New Issue