Commit 8705b2c1 authored by danakj's avatar danakj Committed by Commit Bot

Use base::BindOnce() and OnceClosure for a callback only run once.

R=bokan@chromium.org

Bug: 954011, 1028284
Change-Id: I852b389c12b5bb96cbe2bdef52516b546fe6fdb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1934651Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719177}
parent 8948b517
...@@ -112,12 +112,12 @@ InputHandlerPointerResult ScrollbarController::HandlePointerDown( ...@@ -112,12 +112,12 @@ InputHandlerPointerResult ScrollbarController::HandlePointerDown(
// have the potential of initiating an autoscroll (if held down for long // have the potential of initiating an autoscroll (if held down for long
// enough). // enough).
DCHECK(scrollbar_part != ScrollbarPart::THUMB); DCHECK(scrollbar_part != ScrollbarPart::THUMB);
cancelable_autoscroll_task_ = std::make_unique<base::CancelableClosure>( cancelable_autoscroll_task_ = std::make_unique<base::CancelableOnceClosure>(
base::Bind(&ScrollbarController::StartAutoScrollAnimation, base::BindOnce(&ScrollbarController::StartAutoScrollAnimation,
base::Unretained(this), base::Unretained(this),
InitialDeltaToAutoscrollVelocity( InitialDeltaToAutoscrollVelocity(
scrollbar, scroll_result.scroll_offset), scrollbar, scroll_result.scroll_offset),
scrollbar, scrollbar_part)); scrollbar, scrollbar_part));
layer_tree_host_impl_->task_runner_provider() layer_tree_host_impl_->task_runner_provider()
->ImplThreadTaskRunner() ->ImplThreadTaskRunner()
->PostDelayedTask(FROM_HERE, cancelable_autoscroll_task_->callback(), ->PostDelayedTask(FROM_HERE, cancelable_autoscroll_task_->callback(),
......
...@@ -177,7 +177,7 @@ class CC_EXPORT ScrollbarController { ...@@ -177,7 +177,7 @@ class CC_EXPORT ScrollbarController {
// pointermoves are not VSync aligned). // pointermoves are not VSync aligned).
bool drag_processed_for_current_frame_; bool drag_processed_for_current_frame_;
std::unique_ptr<base::CancelableClosure> cancelable_autoscroll_task_; std::unique_ptr<base::CancelableOnceClosure> cancelable_autoscroll_task_;
}; };
} // namespace cc } // namespace cc
......
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