Commit 1f78c238 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix use-after-move in //cc/trees/layer_tree_host_impl.cc

Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check.

Bug: 1122844
Change-Id: I9183ee204a4e775c25f1e4a5d60628b4e8adb794
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2383013Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803282}
parent 8c98c81c
...@@ -2327,11 +2327,14 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { ...@@ -2327,11 +2327,14 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
active_tree_->source_frame_number()); active_tree_->source_frame_number());
auto compositor_frame = GenerateCompositorFrame(frame); auto compositor_frame = GenerateCompositorFrame(frame);
frame->frame_token = compositor_frame.metadata.frame_token; const auto frame_token = compositor_frame.metadata.frame_token;
frame->frame_token = frame_token;
const viz::BeginFrameId begin_frame_ack_frame_id =
compositor_frame.metadata.begin_frame_ack.frame_id;
// Collect |latency_info| information for tracking // Collect |latency_info| information for tracking
lag_tracking_manager_.CollectScrollEventsFromFrame( lag_tracking_manager_.CollectScrollEventsFromFrame(
frame->frame_token, compositor_frame.metadata.latency_info); frame_token, compositor_frame.metadata.latency_info);
layer_tree_frame_sink_->SubmitCompositorFrame( layer_tree_frame_sink_->SubmitCompositorFrame(
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);
...@@ -2358,8 +2361,7 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { ...@@ -2358,8 +2361,7 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
// No begin-frame is available when doing sync draws, so avoid doing this // No begin-frame is available when doing sync draws, so avoid doing this
// check in that case. // check in that case.
const auto& bfargs = current_begin_frame_tracker_.Current(); const auto& bfargs = current_begin_frame_tracker_.Current();
const auto& ack = compositor_frame.metadata.begin_frame_ack; DCHECK_EQ(bfargs.frame_id, begin_frame_ack_frame_id);
DCHECK_EQ(bfargs.frame_id, ack.frame_id);
} }
#endif #endif
...@@ -2367,9 +2369,9 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) { ...@@ -2367,9 +2369,9 @@ bool LayerTreeHostImpl::DrawLayers(FrameData* frame) {
// outside of begin-impl frame pipeline. Avoid notifying the trackers in such // outside of begin-impl frame pipeline. Avoid notifying the trackers in such
// cases. // cases.
if (impl_thread_phase_ == ImplThreadPhase::INSIDE_IMPL_FRAME) { if (impl_thread_phase_ == ImplThreadPhase::INSIDE_IMPL_FRAME) {
frame_trackers_.NotifySubmitFrame( frame_trackers_.NotifySubmitFrame(frame_token, frame->has_missing_content,
compositor_frame.metadata.frame_token, frame->has_missing_content, frame->begin_frame_ack,
frame->begin_frame_ack, frame->origin_begin_main_frame_args); frame->origin_begin_main_frame_args);
} }
if (!mutator_host_->NextFrameHasPendingRAF()) if (!mutator_host_->NextFrameHasPendingRAF())
......
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