Commit 7e9dea0b authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

More detailed tracing for smooth scrolling.

This cl adds additional tracing for smooth scrolling path in cc. A
NOTREACHED is also added to the invalid case that the scrolling node
exists in layer tree host impl, but the animation update fails.

Bug: 797708
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: If17af64781e78d02f09433e1c0e479231e69b4c2
Reviewed-on: https://chromium-review.googlesource.com/1145736Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579069}
parent f71f5040
......@@ -122,16 +122,25 @@ void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment(
ElementId element_id,
const gfx::Vector2dF& adjustment) {
DCHECK(scroll_offset_animation_);
if (element_id != scroll_offset_animation_->element_id())
if (element_id != scroll_offset_animation_->element_id()) {
TRACE_EVENT_INSTANT0("cc", "no scroll adjustment different element_ids",
TRACE_EVENT_SCOPE_THREAD);
return;
}
if (!scroll_offset_animation_->has_element_animations())
if (!scroll_offset_animation_->has_element_animations()) {
TRACE_EVENT_INSTANT0("cc", "no scroll adjustment no element animation",
TRACE_EVENT_SCOPE_THREAD);
return;
}
KeyframeModel* keyframe_model =
scroll_offset_animation_->GetKeyframeModel(TargetProperty::SCROLL_OFFSET);
if (!keyframe_model)
if (!keyframe_model) {
TRACE_EVENT_INSTANT0("cc", "no scroll adjustment no keyframe model",
TRACE_EVENT_SCOPE_THREAD);
return;
}
std::unique_ptr<ScrollOffsetAnimationCurve> new_curve =
keyframe_model->curve()
......@@ -151,12 +160,16 @@ void ScrollOffsetAnimationsImpl::ScrollAnimationApplyAdjustment(
// Start a new one with the adjusment.
scroll_offset_animation_->AddKeyframeModel(std::move(new_keyframe_model));
TRACE_EVENT_INSTANT0("cc", "scroll animation adjusted",
TRACE_EVENT_SCOPE_THREAD);
}
void ScrollOffsetAnimationsImpl::ScrollAnimationAbort(bool needs_completion) {
DCHECK(scroll_offset_animation_);
scroll_offset_animation_->AbortKeyframeModelsWithProperty(
TargetProperty::SCROLL_OFFSET, needs_completion);
TRACE_EVENT_INSTANT1("cc", "ScrollAnimationAbort", TRACE_EVENT_SCOPE_THREAD,
"needs_completion", needs_completion);
}
void ScrollOffsetAnimationsImpl::NotifyAnimationFinished(
......@@ -166,15 +179,23 @@ void ScrollOffsetAnimationsImpl::NotifyAnimationFinished(
DCHECK_EQ(target_property, TargetProperty::SCROLL_OFFSET);
DCHECK(animation_host_->mutator_host_client());
animation_host_->mutator_host_client()->ScrollOffsetAnimationFinished();
TRACE_EVENT_INSTANT0("cc", "NotifyAnimationFinished",
TRACE_EVENT_SCOPE_THREAD);
}
void ScrollOffsetAnimationsImpl::ReattachScrollOffsetAnimationIfNeeded(
ElementId element_id) {
if (scroll_offset_animation_->element_id() != element_id) {
if (scroll_offset_animation_->element_id())
if (scroll_offset_animation_->element_id()) {
TRACE_EVENT_INSTANT0("cc", "scroll offset animation detached element",
TRACE_EVENT_SCOPE_THREAD);
scroll_offset_animation_->DetachElement();
if (element_id)
}
if (element_id) {
TRACE_EVENT_INSTANT0("cc", "scroll offset animation attached element",
TRACE_EVENT_SCOPE_THREAD);
scroll_offset_animation_->AttachElement(element_id);
}
}
}
......
......@@ -3639,6 +3639,8 @@ bool LayerTreeHostImpl::ScrollAnimationCreate(ScrollNode* scroll_node,
(std::abs(delta.x()) > kEpsilon || std::abs(delta.y()) > kEpsilon);
if (!scroll_animated) {
scroll_tree.ScrollBy(scroll_node, delta, active_tree());
TRACE_EVENT_INSTANT0("cc", "no scroll animation due to small delta",
TRACE_EVENT_SCOPE_THREAD);
return false;
}
......@@ -3706,6 +3708,14 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
scroll_status.thread = SCROLL_IGNORED;
scroll_status.main_thread_scrolling_reasons =
MainThreadScrollingReason::kNotScrollable;
// Adding NOTREACHED to debug https://crbug.com/797708, based on the
// traces on the bug scrolling gets stuck in a situation where the
// layout_tree_host_impl assumes that there is an ongoing scroll animation
// since scroll_node exists but the
// ScrollOffsetAnimationsImpl::ScrollAnimationUpdateTarget returns false
// since no keyframe_model exists. TODO(sahel):remove this once the issue
// is fixed.
NOTREACHED();
}
return scroll_status;
}
......@@ -3758,6 +3768,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
did_scroll_y_for_scroll_gesture_ |= scrolled.y() != 0;
if (scrolled == pending_delta) {
scroll_animating_latched_element_id_ = scroll_node->element_id;
TRACE_EVENT_INSTANT0("cc", "Viewport scroll animated",
TRACE_EVENT_SCOPE_THREAD);
return scroll_status;
}
break;
......@@ -3769,6 +3781,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
did_scroll_x_for_scroll_gesture_ |= scroll_delta.x() != 0;
did_scroll_y_for_scroll_gesture_ |= scroll_delta.y() != 0;
scroll_animating_latched_element_id_ = scroll_node->element_id;
TRACE_EVENT_INSTANT0("cc", "created scroll animation",
TRACE_EVENT_SCOPE_THREAD);
// Flash the overlay scrollbar even if the scroll dalta is 0.
if (settings_.scrollbar_flash_after_any_scroll_update) {
FlashAllScrollbars(false);
......
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