Commit cab0eb5d authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

cc: Add some debug checks.

Add some DCHECK-only code to validate that a CompositorFrame is always
submitted only between calls to WillBeginImplFrame() and
DidFinishImplFrame() (i.e. when a valid BeginFrameArgs is being tracked
by the LayerTreeHostImpl).

Change-Id: I9f344135163d8fabf15c7b670a4a80eb25079e18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894912
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713722}
parent a84a8d08
...@@ -2074,6 +2074,10 @@ void LayerTreeHostImpl::OnDraw(const gfx::Transform& transform, ...@@ -2074,6 +2074,10 @@ void LayerTreeHostImpl::OnDraw(const gfx::Transform& transform,
// external viewport to be set otherwise. // external viewport to be set otherwise.
DCHECK(active_tree_->internal_device_viewport().origin().IsOrigin()); DCHECK(active_tree_->internal_device_viewport().origin().IsOrigin());
#if DCHECK_IS_ON()
base::AutoReset<bool> reset_sync_draw(&doing_sync_draw_, true);
#endif
if (skip_draw) { if (skip_draw) {
client_->OnDrawForLayerTreeFrameSink(resourceless_software_draw_, true); client_->OnDrawForLayerTreeFrameSink(resourceless_software_draw_, true);
return; return;
...@@ -2297,6 +2301,21 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { ...@@ -2297,6 +2301,21 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
std::move(compositor_frame), std::move(compositor_frame),
/*hit_test_data_changed=*/false, debug_state_.show_hit_test_borders); /*hit_test_data_changed=*/false, debug_state_.show_hit_test_borders);
#if DCHECK_IS_ON()
if (!doing_sync_draw_) {
// The throughput computation (in |FrameSequenceTracker|) depends on the
// compositor-frame submission to happen while a BeginFrameArgs is 'active'
// (i.e. between calls to WillBeginImplFrame() and DidFinishImplFrame()).
// Verify that this is the case.
// No begin-frame is available when doing sync draws, so avoid doing this
// check in that case.
const auto& bfargs = current_begin_frame_tracker_.Current();
const auto& ack = compositor_frame.metadata.begin_frame_ack;
DCHECK_EQ(bfargs.source_id, ack.source_id);
DCHECK_EQ(bfargs.sequence_number, ack.sequence_number);
}
#endif
frame_trackers_.NotifySubmitFrame( frame_trackers_.NotifySubmitFrame(
compositor_frame.metadata.frame_token, frame->has_missing_content, compositor_frame.metadata.frame_token, frame->has_missing_content,
frame->begin_frame_ack, frame->origin_begin_main_frame_args); frame->begin_frame_ack, frame->origin_begin_main_frame_args);
......
...@@ -1293,6 +1293,11 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler, ...@@ -1293,6 +1293,11 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler,
// not we are in that state. // not we are in that state.
bool pending_tree_fully_painted_ = false; bool pending_tree_fully_painted_ = false;
#if DCHECK_IS_ON()
// Use to track when doing a synchronous draw.
bool doing_sync_draw_ = false;
#endif
// Provides support for PaintWorklets which depend on input properties that // Provides support for PaintWorklets which depend on input properties that
// are being animated by the compositor (aka 'animated' PaintWorklets). // are being animated by the compositor (aka 'animated' PaintWorklets).
// Responsible for storing animated custom property values and for // Responsible for storing animated custom property values and for
......
This diff is collapsed.
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