Commit 0653a42f authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Avoid using ConvertToBaseOnceCallback needlessly

... in AnimationWorkletMutatorDispatcher code.

Since the code in case is within Blink, there is no
need to convert the WTF::CrossThreadOnceFunction to
base::OnceCallback (with ConvertToBaseOnceCallback).

CL adopts the use of WTF::CrossThreadOnceFunction to
simplify the code.

BUG=963574
R=haraken@chromium.org, hiroshige@chromium.org

Change-Id: I8586dc1397f0861bb42c59dd88bfb7defc534b66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625969
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662529}
parent d422427d
......@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "third_party/blink/renderer/platform/graphics/animation_worklet_mutators_state.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
......@@ -15,7 +16,8 @@ class PLATFORM_EXPORT AnimationWorkletMutatorDispatcher {
public:
virtual ~AnimationWorkletMutatorDispatcher() = default;
using AsyncMutationCompleteCallback = base::OnceCallback<void(MutateStatus)>;
using AsyncMutationCompleteCallback =
WTF::CrossThreadOnceFunction<void(MutateStatus)>;
// Run the animation frame callbacks from all connected AnimationWorklets.
virtual void MutateSynchronously(
......
......@@ -360,28 +360,26 @@ class AnimationWorkletMutatorDispatcherImplAsyncTest
public:
AnimationWorkletMutatorDispatcher::AsyncMutationCompleteCallback
CreateIntermediateResultCallback(MutateStatus expected_result) {
return ConvertToBaseOnceCallback(
CrossThreadBindOnce(&AnimationWorkletMutatorDispatcherImplAsyncTest ::
VerifyExpectedMutationResult,
CrossThreadUnretained(this), expected_result));
return CrossThreadBindOnce(
&AnimationWorkletMutatorDispatcherImplAsyncTest ::
VerifyExpectedMutationResult,
CrossThreadUnretained(this), expected_result);
}
AnimationWorkletMutatorDispatcher::AsyncMutationCompleteCallback
CreateNotReachedCallback() {
return ConvertToBaseOnceCallback(
CrossThreadBindOnce([](MutateStatus unused) {
NOTREACHED()
<< "Mutate complete callback should not have been triggered";
}));
return CrossThreadBindOnce([](MutateStatus unused) {
NOTREACHED() << "Mutate complete callback should not have been triggered";
});
}
AnimationWorkletMutatorDispatcher::AsyncMutationCompleteCallback
CreateTestCompleteCallback(
MutateStatus expected_result = MutateStatus::kCompletedWithUpdate) {
return ConvertToBaseOnceCallback(
CrossThreadBindOnce(&AnimationWorkletMutatorDispatcherImplAsyncTest ::
VerifyCompletedMutationResultAndFinish,
CrossThreadUnretained(this), expected_result));
return CrossThreadBindOnce(
&AnimationWorkletMutatorDispatcherImplAsyncTest ::
VerifyCompletedMutationResultAndFinish,
CrossThreadUnretained(this), expected_result);
}
// Executes run loop until quit closure is called.
......
......@@ -6,6 +6,7 @@
#include <memory>
#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/platform/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator_dispatcher_impl.h"
namespace blink {
......@@ -28,8 +29,9 @@ bool CompositorMutatorClient::Mutate(
MutateQueuingStrategy queueing_strategy,
DoneCallback on_done) {
TRACE_EVENT0("cc", "CompositorMutatorClient::Mutate");
return mutator_->MutateAsynchronously(std::move(input_state),
queueing_strategy, std::move(on_done));
return mutator_->MutateAsynchronously(
std::move(input_state), queueing_strategy,
CrossThreadBindOnce(std::move(on_done)));
}
void CompositorMutatorClient::SetMutationUpdate(
......
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