0

Rename WTF::Bind to WTF::BindOnce.

This change is mechanical largely done via sed.
git grep -l "WTF::Bind(" | xargs -x sed -i -e "s/WTF::Bind(/WTF::BindOnce(/g"

This change does add a duplicate definition of WTF::BindOnce as WTF::Bind to avoid reverts of the large CL if any further WTF::Binds
are added. The additional definition will be removed in a followup CL.

BUG=882836

Change-Id: Ia35ebe72f0ce22d8e2e03474067fc8ce51d3f117
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3900855
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047984}
This commit is contained in:
Dave Tapuska
2022-09-16 14:02:31 +00:00
committed by Chromium LUCI CQ
parent 0d23bc38f7
commit 28700f96a2
479 changed files with 2561 additions and 2393 deletions
base/task
docs
third_party/blink/renderer
bindings
controller
core
animation
animation_frame
annotation
clipboard
css
display_lock
document_transition
dom
editing
exported
fetch
fileapi
fragment_directive
frame
fullscreen
html
input
inspector
intersection_observer
layout
loader
messaging
mojo
navigation_api
offscreencanvas
page
paint
scheduler_integration_tests
script
scroll
speculation_rules
svg
testing
timing
web_test
workers
xmlhttprequest
extensions
chromeos
system_extensions
modules
accessibility
ad_auction
audio_output_devices
background_fetch
background_sync
battery
bluetooth
breakout_box
broadcastchannel
browsing_topics
buckets
cache_storage
canvas
clipboard
compute_pressure
contacts_picker
content_index
cookie_store
credentialmanagement
device_orientation
device_posture
direct_sockets
document_picture_in_picture
encryptedmedia
eyedropper
file_system_access
filesystem
font_access
gamepad
geolocation
handwriting
hid
idle
image_downloader
imagecapture
indexeddb
installedapp
keyboard
locks
managed_device
manifest
media
media_capabilities
media_controls
mediacapturefromelement
mediarecorder
mediasource
mediastream
ml
native_io
nfc
notifications
payments
peerconnection
permissions
presentation
push_messaging
quota
remoteplayback
scheduler
screen_enumeration
screen_orientation
sensor
serial
service_worker
shapedetection
shared_storage
speech
storage
subapps
vibration
video_rvfc
wake_lock
webaudio
webcodecs
webdatabase
webgl
webmidi
webrtc
webshare
websockets
webtransport
webusb
xr
platform

@ -49,8 +49,9 @@ class BindPostTaskTrampoline {
// passed to BindPostTaskTrampoline then the BindState can outlive
// `callback_`, so the user must ensure any other copies of the callback
// are also destroyed on the correct task runner.
task_runner_->PostTask(location_, BindOnce(&DestroyCallbackOnTaskRunner,
std::move(callback_)));
task_runner_->PostTask(
location_,
base::BindOnce(&DestroyCallbackOnTaskRunner, std::move(callback_)));
}
}
@ -70,7 +71,7 @@ class BindPostTaskTrampoline {
template <typename... Args>
static OnceClosure GetClosure(OnceCallback<void(Args...)>* callback,
Args&&... args) {
return BindOnce(std::move(*callback), std::forward<Args>(args)...);
return base::BindOnce(std::move(*callback), std::forward<Args>(args)...);
}
static OnceClosure GetClosure(RepeatingClosure* callback) {
@ -81,7 +82,7 @@ class BindPostTaskTrampoline {
template <typename... Args>
static OnceClosure GetClosure(RepeatingCallback<void(Args...)>* callback,
Args&&... args) {
return BindOnce(*callback, std::forward<Args>(args)...);
return base::BindOnce(*callback, std::forward<Args>(args)...);
}
static void DestroyCallbackOnTaskRunner(CallbackType callback) {}

@ -420,7 +420,7 @@ documentation.
### Binding callbacks
Mojo methods that return a value take an instance of `base::OnceCallback`.
Use `WTF::Bind()` and an appropriate wrapper function depending on the type of
Use `WTF::BindOnce()` and an appropriate wrapper function depending on the type of
object and the callback.
For garbage-collected (Oilpan) classes owning the `mojo::Remote`, it is recommended
@ -433,11 +433,11 @@ the response is received, use `WrapWeakPersistent(this)` for binding the respons
``` cpp
// src/third_party/blink/renderer/modules/device_orientation/device_sensor_entry.cc
sensor_.set_connection_error_handler(WTF::Bind(
sensor_.set_connection_error_handler(WTF::BindOnce(
&DeviceSensorEntry::HandleSensorError, WrapWeakPersistent(this)));
sensor_->ConfigureReadingChangeNotifications(/*enabled=*/false);
sensor_->AddConfiguration(
std::move(config), WTF::Bind(&DeviceSensorEntry::OnSensorAddConfiguration,
std::move(config), WTF::BindOnce(&DeviceSensorEntry::OnSensorAddConfiguration,
WrapWeakPersistent(this)));
```
@ -448,7 +448,7 @@ use `WrapPersistent(this)` to keep the object alive:
// src/third_party/blink/renderer/modules/nfc/nfc.cc
ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
...
nfc_->CancelAllWatches(WTF::Bind(&NFC::OnRequestCompleted,
nfc_->CancelAllWatches(WTF::BindOnce(&NFC::OnRequestCompleted,
WrapPersistent(this),
WrapPersistent(resolver)));
```

@ -153,7 +153,7 @@ void JSEventHandler::InvokeInternal(EventTarget& event_target,
// necessary only for OnBeforeUnloadEventHandler.
String result_for_beforeunload;
if (IsOnBeforeUnloadEventHandler()) {
event_handler_->EvaluateAsPartOfCallback(Bind(
event_handler_->EvaluateAsPartOfCallback(WTF::BindOnce(
[](v8::Local<v8::Value>& v8_return_value,
String& result_for_beforeunload) {
// TODO(yukiy): use |NativeValueTraits|.

@ -26,7 +26,7 @@ TEST_F(NoAllocDirectCallHostTest, ActionsExecutedImmediatelyWhenAllocAllowed) {
NoAllocDirectCallHost host;
ASSERT_FALSE(host.IsInFastMode());
bool change_me = false;
host.PostDeferrableAction(WTF::Bind(
host.PostDeferrableAction(WTF::BindOnce(
[](bool* change_me) { *change_me = true; }, WTF::Unretained(&change_me)));
ASSERT_TRUE(change_me);
ASSERT_FALSE(host.HasDeferredActions());
@ -40,8 +40,8 @@ TEST_F(NoAllocDirectCallHostTest, ActionsDeferredWhenAllocDisallowed) {
NoAllocDirectCallScope scope(&host, callback_options());
ASSERT_TRUE(host.IsInFastMode());
host.PostDeferrableAction(
WTF::Bind([](bool* change_me) { *change_me = true; },
WTF::Unretained(&change_me)));
WTF::BindOnce([](bool* change_me) { *change_me = true; },
WTF::Unretained(&change_me)));
}
ASSERT_FALSE(host.IsInFastMode());
ASSERT_FALSE(change_me);
@ -55,8 +55,8 @@ TEST_F(NoAllocDirectCallHostTest, FlushDeferredActions) {
{
NoAllocDirectCallScope scope(&host, callback_options());
host.PostDeferrableAction(
WTF::Bind([](bool* change_me) { *change_me = true; },
WTF::Unretained(&change_me)));
WTF::BindOnce([](bool* change_me) { *change_me = true; },
WTF::Unretained(&change_me)));
}
ASSERT_TRUE(IsFallbackRequested());
if (host.HasDeferredActions()) {

@ -215,9 +215,10 @@ void RejectedPromises::HandlerAdded(v8::PromiseRejectMessage data) {
// a separate statement.
ExecutionContext* context = message->GetContext();
context->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE, WTF::Bind(&RejectedPromises::RevokeNow,
scoped_refptr<RejectedPromises>(this),
std::move(message)));
->PostTask(FROM_HERE,
WTF::BindOnce(&RejectedPromises::RevokeNow,
scoped_refptr<RejectedPromises>(this),
std::move(message)));
reported_as_errors_.EraseAt(i);
return;
}
@ -245,9 +246,10 @@ void RejectedPromises::ProcessQueue() {
for (auto& kv : queues) {
kv.key->GetTaskRunner(blink::TaskType::kDOMManipulation)
->PostTask(FROM_HERE, WTF::Bind(&RejectedPromises::ProcessQueueNow,
scoped_refptr<RejectedPromises>(this),
std::move(kv.value)));
->PostTask(FROM_HERE,
WTF::BindOnce(&RejectedPromises::ProcessQueueNow,
scoped_refptr<RejectedPromises>(this),
std::move(kv.value)));
}
}

@ -153,8 +153,8 @@ void ScriptPromiseResolver::ResolveOrRejectImmediately() {
void ScriptPromiseResolver::ScheduleResolveOrReject() {
deferred_resolve_task_ = PostCancellableTask(
*GetExecutionContext()->GetTaskRunner(TaskType::kMicrotask), FROM_HERE,
WTF::Bind(&ScriptPromiseResolver::ResolveOrRejectDeferred,
WrapPersistent(this)));
WTF::BindOnce(&ScriptPromiseResolver::ResolveOrRejectDeferred,
WrapPersistent(this)));
}
void ScriptPromiseResolver::ResolveOrRejectDeferred() {

@ -81,7 +81,7 @@ class CORE_EXPORT ScriptPromiseResolver
template <class ScriptPromiseResolver, typename... Args>
base::OnceCallback<void(Args...)> WrapCallbackInScriptScope(
base::OnceCallback<void(ScriptPromiseResolver*, Args...)> callback) {
return WTF::Bind(
return WTF::BindOnce(
[](ScriptPromiseResolver* resolver,
base::OnceCallback<void(ScriptPromiseResolver*, Args...)> callback,
Args... args) {

@ -542,15 +542,15 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript(
frame ? TaskType::kIdleTask : TaskType::kInternalDefault;
execution_context->GetTaskRunner(task_type)->PostDelayedTask(
FROM_HERE,
WTF::Bind(&DelayedProduceCodeCacheTask,
// TODO(leszeks): Consider passing the
// script state as a weak persistent.
WrapPersistent(script_state),
v8::Global<v8::Script>(isolate, script),
WrapPersistent(cache_handler),
classic_script->SourceText().length(),
classic_script->SourceUrl(),
classic_script->StartPosition()),
WTF::BindOnce(&DelayedProduceCodeCacheTask,
// TODO(leszeks): Consider passing the
// script state as a weak persistent.
WrapPersistent(script_state),
v8::Global<v8::Script>(isolate, script),
WrapPersistent(cache_handler),
classic_script->SourceText().length(),
classic_script->SourceUrl(),
classic_script->StartPosition()),
delay);
} else {
V8CodeCache::ProduceCache(
@ -837,10 +837,11 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule(
// [not specced] Store V8 code cache on successful evaluation.
if (result.GetResultType() == ScriptEvaluationResult::ResultType::kSuccess) {
execution_context->GetTaskRunner(TaskType::kNetworking)
->PostTask(FROM_HERE,
WTF::Bind(&Modulator::ProduceCacheModuleTreeTopLevel,
WrapWeakPersistent(Modulator::From(script_state)),
WrapWeakPersistent(module_script)));
->PostTask(
FROM_HERE,
WTF::BindOnce(&Modulator::ProduceCacheModuleTreeTopLevel,
WrapWeakPersistent(Modulator::From(script_state)),
WrapWeakPersistent(module_script)));
}
if (!rethrow_errors.ShouldRethrow()) {

@ -118,7 +118,7 @@ void DevToolsFrontendImpl::SetupDevToolsFrontend(
api_script_ = api_script;
host_.Bind(std::move(host),
GetSupplementable()->GetTaskRunner(TaskType::kMiscPlatformAPI));
host_.set_disconnect_handler(WTF::Bind(
host_.set_disconnect_handler(WTF::BindOnce(
&DevToolsFrontendImpl::DestroyOnHostGone, WrapWeakPersistent(this)));
GetSupplementable()->GetPage()->SetDefaultPageScaleLimits(1.f, 1.f);
}

@ -93,7 +93,8 @@ void HighestPmfReporter::OnMemoryPing(MemoryUsage usage) {
if (FirstNavigationStarted()) {
task_runner_->PostDelayedTask(
FROM_HERE,
WTF::Bind(&HighestPmfReporter::OnReportMetrics, WTF::Unretained(this)),
WTF::BindOnce(&HighestPmfReporter::OnReportMetrics,
WTF::Unretained(this)),
time_to_report[0]);
}
@ -131,7 +132,8 @@ void HighestPmfReporter::OnReportMetrics() {
time_to_report[report_count_] - time_to_report[report_count_ - 1];
task_runner_->PostDelayedTask(
FROM_HERE,
WTF::Bind(&HighestPmfReporter::OnReportMetrics, WTF::Unretained(this)),
WTF::BindOnce(&HighestPmfReporter::OnReportMetrics,
WTF::Unretained(this)),
delay);
}

@ -142,16 +142,16 @@ class V8ProcessMemoryReporter : public RefCounted<V8ProcessMemoryReporter> {
MainMeasurementComplete(mojom::blink::PerIsolateV8MemoryUsage::New());
} else {
auto delegate = std::make_unique<FrameAssociatedMeasurementDelegate>(
WTF::Bind(&V8ProcessMemoryReporter::MainV8MeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this)));
WTF::BindOnce(&V8ProcessMemoryReporter::MainV8MeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this)));
isolate_->MeasureMemory(std::move(delegate),
ToV8MeasureMemoryExecution(mode));
}
// 2. Start measurement of all worker isolates.
V8WorkerMemoryReporter::GetMemoryUsage(
WTF::Bind(&V8ProcessMemoryReporter::WorkerMeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this)),
WTF::BindOnce(&V8ProcessMemoryReporter::WorkerMeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this)),
ToV8MeasureMemoryExecution(mode));
}
@ -167,9 +167,9 @@ class V8ProcessMemoryReporter : public RefCounted<V8ProcessMemoryReporter> {
// heap given by ThreadState::Current() is attached to the main V8
// isolate given by v8::Isolate::GetCurrent().
ThreadState::Current()->CollectNodeAndCssStatistics(
WTF::Bind(&V8ProcessMemoryReporter::MainBlinkMeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this),
std::move(isolate_memory_usage)));
WTF::BindOnce(&V8ProcessMemoryReporter::MainBlinkMeasurementComplete,
scoped_refptr<V8ProcessMemoryReporter>(this),
std::move(isolate_memory_usage)));
}
void MainBlinkMeasurementComplete(

@ -138,7 +138,7 @@ TEST_F(V8DetailedMemoryReporterImplTest, GetV8MemoryUsage) {
MemoryUsageChecker checker(expected_isolate_count, expected_context_count);
reporter.GetV8MemoryUsage(
V8DetailedMemoryReporterImpl::Mode::EAGER,
WTF::Bind(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)));
WTF::BindOnce(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)));
test::EnterRunLoop();
@ -162,7 +162,7 @@ TEST_F(V8DetailedMemoryReporterImplWorkerTest, GetV8MemoryUsage) {
MemoryUsageChecker checker(expected_isolate_count, expected_context_count);
reporter.GetV8MemoryUsage(
V8DetailedMemoryReporterImpl::Mode::EAGER,
WTF::Bind(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)));
WTF::BindOnce(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)));
test::EnterRunLoop();
EXPECT_TRUE(checker.IsCalled());
}
@ -204,8 +204,8 @@ TEST_F(V8DetailedMemoryReporterImplTest, CanvasMemoryUsage) {
V8DetailedMemoryReporterImpl reporter;
CanvasMemoryUsageChecker checker(10, 10);
reporter.GetV8MemoryUsage(V8DetailedMemoryReporterImpl::Mode::EAGER,
WTF::Bind(&CanvasMemoryUsageChecker::Callback,
WTF::Unretained(&checker)));
WTF::BindOnce(&CanvasMemoryUsageChecker::Callback,
WTF::Unretained(&checker)));
test::EnterRunLoop();

@ -150,16 +150,16 @@ void V8WorkerMemoryReporter::GetMemoryUsage(ResultCallback callback,
main_thread_task_runner, worker_memory_reporter->GetWeakPtr(), mode);
if (worker_count == 0) {
main_thread_task_runner->PostTask(
FROM_HERE, WTF::Bind(&V8WorkerMemoryReporter::InvokeCallback,
std::move(worker_memory_reporter)));
FROM_HERE, WTF::BindOnce(&V8WorkerMemoryReporter::InvokeCallback,
std::move(worker_memory_reporter)));
return;
}
worker_memory_reporter->SetWorkerCount(worker_count);
// Transfer the ownership of the instance to the timeout task.
main_thread_task_runner->PostDelayedTask(
FROM_HERE,
WTF::Bind(&V8WorkerMemoryReporter::OnTimeout,
std::move(worker_memory_reporter)),
WTF::BindOnce(&V8WorkerMemoryReporter::OnTimeout,
std::move(worker_memory_reporter)),
kTimeout);
}

@ -87,7 +87,7 @@ class MemoryUsageChecker {
TEST_F(V8WorkerMemoryReporterTest, OnMeasurementSuccess) {
MockCallback mock_callback;
V8WorkerMemoryReporter reporter(
WTF::Bind(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
WTF::BindOnce(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
reporter.SetWorkerCount(6);
Result result = {Vector<WorkerMemoryUsage>(
{WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 1},
@ -106,7 +106,7 @@ TEST_F(V8WorkerMemoryReporterTest, OnMeasurementSuccess) {
TEST_F(V8WorkerMemoryReporterTest, OnMeasurementFailure) {
MockCallback mock_callback;
V8WorkerMemoryReporter reporter(
WTF::Bind(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
WTF::BindOnce(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
reporter.SetWorkerCount(3);
Result result = {Vector<WorkerMemoryUsage>(
{WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 1},
@ -123,7 +123,7 @@ TEST_F(V8WorkerMemoryReporterTest, OnMeasurementFailure) {
TEST_F(V8WorkerMemoryReporterTest, OnTimeout) {
MockCallback mock_callback;
V8WorkerMemoryReporter reporter(
WTF::Bind(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
WTF::BindOnce(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
reporter.SetWorkerCount(4);
Result result = {Vector<WorkerMemoryUsage>(
{WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 1},
@ -144,7 +144,7 @@ TEST_F(V8WorkerMemoryReporterTest, OnTimeout) {
TEST_F(V8WorkerMemoryReporterTest, OnTimeoutNoop) {
MockCallback mock_callback;
V8WorkerMemoryReporter reporter(
WTF::Bind(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
WTF::BindOnce(&MockCallback::Callback, WTF::Unretained(&mock_callback)));
reporter.SetWorkerCount(2);
Result result = {Vector<WorkerMemoryUsage>(
{WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 1},
@ -168,7 +168,7 @@ TEST_F(V8WorkerMemoryReporterTestWithDedicatedWorker, GetMemoryUsage) {
MemoryUsageChecker checker(1, kBytesPerArrayElement * kArrayLength,
MemoryUsageChecker::CallbackAction::kExitRunLoop);
V8WorkerMemoryReporter::GetMemoryUsage(
WTF::Bind(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)),
WTF::BindOnce(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)),
v8::MeasureMemoryExecution::kEager);
test::EnterRunLoop();
EXPECT_TRUE(checker.IsCalled());
@ -182,7 +182,7 @@ TEST_F(V8WorkerMemoryReporterTestWithMockPlatform, GetMemoryUsageTimeout) {
// we cannot call WaitUntilWorkerIsRunning here as that would block.
MemoryUsageChecker checker(0, 0, MemoryUsageChecker::CallbackAction::kNone);
V8WorkerMemoryReporter::GetMemoryUsage(
WTF::Bind(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)),
WTF::BindOnce(&MemoryUsageChecker::Callback, WTF::Unretained(&checker)),
v8::MeasureMemoryExecution::kEager);
platform()->RunForPeriodSeconds(V8WorkerMemoryReporter::kTimeout.InSeconds() +
1);

@ -1717,8 +1717,8 @@ void Animation::ScheduleAsyncFinish() {
// state temporarily.
pending_finish_notification_ = true;
if (!has_queued_microtask_) {
Microtask::EnqueueMicrotask(
WTF::Bind(&Animation::AsyncFinishMicrotask, WrapWeakPersistent(this)));
Microtask::EnqueueMicrotask(WTF::BindOnce(&Animation::AsyncFinishMicrotask,
WrapWeakPersistent(this)));
has_queued_microtask_ = true;
}
}
@ -2564,9 +2564,10 @@ void Animation::ResolvePromiseMaybeAsync(AnimationPromise* promise) {
if (ScriptForbiddenScope::IsScriptForbidden()) {
GetExecutionContext()
->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&AnimationPromise::Resolve<Animation*>,
WrapPersistent(promise), WrapPersistent(this)));
->PostTask(
FROM_HERE,
WTF::BindOnce(&AnimationPromise::Resolve<Animation*>,
WrapPersistent(promise), WrapPersistent(this)));
} else {
promise->Resolve(this);
}
@ -2582,9 +2583,9 @@ void Animation::RejectAndResetPromiseMaybeAsync(AnimationPromise* promise) {
if (ScriptForbiddenScope::IsScriptForbidden()) {
GetExecutionContext()
->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&Animation::RejectAndResetPromise,
WrapPersistent(this), WrapPersistent(promise)));
->PostTask(FROM_HERE, WTF::BindOnce(&Animation::RejectAndResetPromise,
WrapPersistent(this),
WrapPersistent(promise)));
} else {
RejectAndResetPromise(promise);
}

@ -287,8 +287,8 @@ void DocumentAnimations::RemoveReplacedAnimations(
for (auto it = animations_to_remove.rbegin();
it != animations_to_remove.rend(); it++) {
Animation* animation = *it;
Microtask::EnqueueMicrotask(WTF::Bind(&Animation::RemoveReplacedAnimation,
WrapWeakPersistent(animation)));
Microtask::EnqueueMicrotask(WTF::BindOnce(
&Animation::RemoveReplacedAnimation, WrapWeakPersistent(animation)));
}
}

@ -42,7 +42,7 @@ void WorkerAnimationFrameProvider::BeginFrame(const viz::BeginFrameArgs& args) {
TRACE_ID_GLOBAL(args.trace_id),
TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT);
Microtask::EnqueueMicrotask(WTF::Bind(
Microtask::EnqueueMicrotask(WTF::BindOnce(
[](WeakPersistent<WorkerAnimationFrameProvider> provider,
const viz::BeginFrameArgs& args) {
if (!provider)

@ -150,8 +150,8 @@ void AnnotationAgentContainerImpl::CreateAgentFromSelection(
DCHECK(annotation_agent_generator_);
annotation_agent_generator_->GetForCurrentSelection(
type,
WTF::Bind(&AnnotationAgentContainerImpl::DidFinishSelectorGeneration,
WrapWeakPersistent(this), std::move(callback)));
WTF::BindOnce(&AnnotationAgentContainerImpl::DidFinishSelectorGeneration,
WrapWeakPersistent(this), std::move(callback)));
}
// TODO(cheickcisse@): Move shared highlighting enums, also used in user note to

@ -141,9 +141,10 @@ void AnnotationAgentGenerator::GenerateSelector() {
generator_ = MakeGarbageCollected<TextFragmentSelectorGenerator>(frame_);
}
generator_->Generate(*current_selection_range,
WTF::Bind(&AnnotationAgentGenerator::DidFinishGeneration,
WrapWeakPersistent(this)));
generator_->Generate(
*current_selection_range,
WTF::BindOnce(&AnnotationAgentGenerator::DidFinishGeneration,
WrapWeakPersistent(this)));
}
void AnnotationAgentGenerator::DidFinishGeneration(

@ -63,15 +63,15 @@ void AnnotationAgentImpl::Bind(
// Breaking the mojo connection will cause this agent to remove itself from
// the container.
receiver_.set_disconnect_handler(
WTF::Bind(&AnnotationAgentImpl::Remove, WrapWeakPersistent(this)));
WTF::BindOnce(&AnnotationAgentImpl::Remove, WrapWeakPersistent(this)));
}
void AnnotationAgentImpl::Attach() {
DCHECK(!IsRemoved());
Document& document = *owning_container_->GetSupplementable();
selector_->FindRange(document, AnnotationSelector::kSynchronous,
WTF::Bind(&AnnotationAgentImpl::DidFinishAttach,
WrapWeakPersistent(this)));
WTF::BindOnce(&AnnotationAgentImpl::DidFinishAttach,
WrapWeakPersistent(this)));
}
bool AnnotationAgentImpl::IsAttached() const {

@ -76,11 +76,11 @@ void DataTransferItem::getAsString(ScriptState* script_state,
auto task_context = std::make_unique<probe::AsyncTaskContext>();
task_context->Schedule(context, "DataTransferItem.getAsString");
context->GetTaskRunner(TaskType::kUserInteraction)
->PostTask(
FROM_HERE,
WTF::Bind(&DataTransferItem::RunGetAsStringTask, WrapPersistent(this),
WrapPersistent(context), WrapPersistent(callback),
item_->GetAsString(), std::move(task_context)));
->PostTask(FROM_HERE,
WTF::BindOnce(&DataTransferItem::RunGetAsStringTask,
WrapPersistent(this), WrapPersistent(context),
WrapPersistent(callback), item_->GetAsString(),
std::move(task_context)));
}
File* DataTransferItem::getAsFile() const {

@ -501,23 +501,23 @@ void FontFace::SetLoadStatus(LoadStatusType status) {
GetExecutionContext()
->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&LoadedProperty::Resolve<FontFace*>,
WrapPersistent(loaded_property_.Get()),
WrapPersistent(this)));
WTF::BindOnce(&LoadedProperty::Resolve<FontFace*>,
WrapPersistent(loaded_property_.Get()),
WrapPersistent(this)));
} else {
GetExecutionContext()
->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&LoadedProperty::Reject<DOMException*>,
WrapPersistent(loaded_property_.Get()),
WrapPersistent(error_.Get())));
WTF::BindOnce(&LoadedProperty::Reject<DOMException*>,
WrapPersistent(loaded_property_.Get()),
WrapPersistent(error_.Get())));
}
}
GetExecutionContext()
->GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&FontFace::RunCallbacks, WrapPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&FontFace::RunCallbacks,
WrapPersistent(this)));
}
}

@ -22,8 +22,8 @@ void FontFaceSet::HandlePendingEventsAndPromisesSoon() {
pending_task_queued_ = true;
context->GetTaskRunner(TaskType::kFontLoading)
->PostTask(FROM_HERE,
WTF::Bind(&FontFaceSet::HandlePendingEventsAndPromises,
WrapPersistent(this)));
WTF::BindOnce(&FontFaceSet::HandlePendingEventsAndPromises,
WrapPersistent(this)));
}
}
}

@ -123,8 +123,8 @@ void LocalFontFaceSource::BeginLoadIfNeeded() {
FontGlobalContext::Get().GetFontUniqueNameLookup();
DCHECK(unique_name_lookup);
unique_name_lookup->PrepareFontUniqueNameLookup(
WTF::Bind(&LocalFontFaceSource::NotifyFontUniqueNameLookupReady,
WrapWeakPersistent(this)));
WTF::BindOnce(&LocalFontFaceSource::NotifyFontUniqueNameLookupReady,
WrapWeakPersistent(this)));
face_->DidBeginLoad();
}

@ -147,12 +147,12 @@ void DisplayLockDocumentState::ProcessDisplayLockActivationObservation(
if (context->HadAnyViewportIntersectionNotifications()) {
if (entry->isIntersecting()) {
document_->View()->EnqueueStartOfLifecycleTask(
WTF::Bind(&DisplayLockContext::NotifyIsIntersectingViewport,
WrapWeakPersistent(context)));
WTF::BindOnce(&DisplayLockContext::NotifyIsIntersectingViewport,
WrapWeakPersistent(context)));
} else {
document_->View()->EnqueueStartOfLifecycleTask(
WTF::Bind(&DisplayLockContext::NotifyIsNotIntersectingViewport,
WrapWeakPersistent(context)));
WTF::BindOnce(&DisplayLockContext::NotifyIsNotIntersectingViewport,
WrapWeakPersistent(context)));
}
had_asynchronous_notifications = true;
} else {
@ -172,8 +172,8 @@ void DisplayLockDocumentState::ProcessDisplayLockActivationObservation(
// lifecycle).
document_->GetTaskRunner(TaskType::kInternalFrameLifecycleControl)
->PostTask(FROM_HERE,
WTF::Bind(&DisplayLockDocumentState::ScheduleAnimation,
WrapWeakPersistent(this)));
WTF::BindOnce(&DisplayLockDocumentState::ScheduleAnimation,
WrapWeakPersistent(this)));
}
}

@ -545,8 +545,8 @@ void DocumentTransition::PauseRendering() {
document_->GetTaskRunner(TaskType::kInternalFrameLifecycleControl)
->PostDelayedTask(
FROM_HERE,
WTF::Bind(&DocumentTransition::OnRenderingPausedTimeout,
WrapWeakPersistent(this), last_prepare_sequence_id_),
WTF::BindOnce(&DocumentTransition::OnRenderingPausedTimeout,
WrapWeakPersistent(this), last_prepare_sequence_id_),
kTimeout);
}

@ -105,8 +105,8 @@ AbortSignal* AbortSignal::timeout(ScriptState* script_state,
// there are or will be event handlers attached.
context->GetTaskRunner(task_type)->PostDelayedTask(
FROM_HERE,
WTF::Bind(&AbortSignal::AbortTimeoutFired, WrapPersistent(signal),
WrapPersistent(script_state)),
WTF::BindOnce(&AbortSignal::AbortTimeoutFired, WrapPersistent(signal),
WrapPersistent(script_state)),
base::Milliseconds(milliseconds));
return signal;
}

@ -4437,8 +4437,8 @@ void Document::DidLoadAllScriptBlockingResources() {
// just for executing scripts.
execute_scripts_waiting_for_resources_task_handle_ = PostCancellableTask(
*GetTaskRunner(TaskType::kNetworking), FROM_HERE,
WTF::Bind(&Document::ExecuteScriptsWaitingForResources,
WrapWeakPersistent(this)));
WTF::BindOnce(&Document::ExecuteScriptsWaitingForResources,
WrapWeakPersistent(this)));
if (IsA<HTMLDocument>(this) && body()) {
// For HTML if we have no more stylesheets to load and we're past the body
@ -6041,7 +6041,7 @@ mojom::blink::PermissionService* Document::GetPermissionService(
execution_context->GetBrowserInterfaceBroker().GetInterface(
data_->permission_service_.BindNewPipeAndPassReceiver(
execution_context->GetTaskRunner(TaskType::kPermission)));
data_->permission_service_.set_disconnect_handler(WTF::Bind(
data_->permission_service_.set_disconnect_handler(WTF::BindOnce(
&Document::PermissionServiceConnectionError, WrapWeakPersistent(this)));
}
return data_->permission_service_.get();
@ -6154,7 +6154,7 @@ ScriptPromise Document::requestStorageAccessForSite(ScriptState* script_state,
GetPermissionService(ExecutionContext::From(script_state))
->RequestPermission(
std::move(descriptor), has_user_gesture,
WTF::Bind(
WTF::BindOnce(
[](ScriptPromiseResolver* resolver, Document* document,
mojom::blink::PermissionStatus status) {
DCHECK(resolver);
@ -6268,7 +6268,7 @@ ScriptPromise Document::requestStorageAccess(ScriptState* script_state) {
GetPermissionService(ExecutionContext::From(script_state))
->RequestPermission(
std::move(descriptor), has_user_gesture,
WTF::Bind(
WTF::BindOnce(
[](ScriptPromiseResolver* resolver, Document* document,
mojom::blink::PermissionStatus status) {
DCHECK(resolver);
@ -6355,15 +6355,15 @@ ScriptPromise Document::hasTrustToken(ScriptState* script_state,
data_->trust_token_query_answerer_.BindNewPipeAndPassReceiver(
GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault)));
data_->trust_token_query_answerer_.set_disconnect_handler(
WTF::Bind(&Document::TrustTokenQueryAnswererConnectionError,
WrapWeakPersistent(this)));
WTF::BindOnce(&Document::TrustTokenQueryAnswererConnectionError,
WrapWeakPersistent(this)));
}
data_->pending_trust_token_query_resolvers_.insert(resolver);
data_->trust_token_query_answerer_->HasTrustTokens(
issuer_origin,
WTF::Bind(
WTF::BindOnce(
[](WeakPersistent<ScriptPromiseResolver> resolver,
WeakPersistent<Document> document,
network::mojom::blink::HasTrustTokensResultPtr result) {
@ -6450,15 +6450,15 @@ ScriptPromise Document::hasRedemptionRecord(ScriptState* script_state,
data_->trust_token_query_answerer_.BindNewPipeAndPassReceiver(
GetExecutionContext()->GetTaskRunner(TaskType::kInternalDefault)));
data_->trust_token_query_answerer_.set_disconnect_handler(
WTF::Bind(&Document::TrustTokenQueryAnswererConnectionError,
WrapWeakPersistent(this)));
WTF::BindOnce(&Document::TrustTokenQueryAnswererConnectionError,
WrapWeakPersistent(this)));
}
data_->pending_trust_token_query_resolvers_.insert(resolver);
data_->trust_token_query_answerer_->HasRedemptionRecord(
issuer_origin,
WTF::Bind(
WTF::BindOnce(
[](WeakPersistent<ScriptPromiseResolver> resolver,
WeakPersistent<Document> document,
network::mojom::blink::HasRedemptionRecordResultPtr result) {
@ -8490,9 +8490,10 @@ void Document::ProcessJavaScriptUrl(
GetFrame()->Loader().Progress().ProgressStarted();
pending_javascript_urls_.push_back(PendingJavascriptUrl(url, world));
if (!javascript_url_task_handle_.IsActive()) {
javascript_url_task_handle_ = PostCancellableTask(
*GetTaskRunner(TaskType::kNetworking), FROM_HERE,
WTF::Bind(&Document::ExecuteJavaScriptUrls, WrapWeakPersistent(this)));
javascript_url_task_handle_ =
PostCancellableTask(*GetTaskRunner(TaskType::kNetworking), FROM_HERE,
WTF::BindOnce(&Document::ExecuteJavaScriptUrls,
WrapWeakPersistent(this)));
}
}

@ -3456,7 +3456,7 @@ Node::InsertionNotificationRequest Element::InsertedInto(
GetDocument()
.GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(maybe_show_popup, WrapWeakPersistent(this)));
WTF::BindOnce(maybe_show_popup, WrapWeakPersistent(this)));
}
TreeScope& scope = insertion_point.GetTreeScope();

@ -67,8 +67,8 @@ bool EventQueue::EnqueueEvent(const base::Location& from_here, Event& event) {
// Pass the event as a weak persistent so that GC can collect an event-related
// object like IDBTransaction as soon as possible.
task_runner->PostTask(
from_here, WTF::Bind(&EventQueue::DispatchEvent, WrapPersistent(this),
WrapWeakPersistent(&event)));
from_here, WTF::BindOnce(&EventQueue::DispatchEvent, WrapPersistent(this),
WrapWeakPersistent(&event)));
return true;
}

@ -482,7 +482,7 @@ bool EventTarget::AddEventListenerInternal(
// pass the |options->capture()| boolean, which is the only thing
// removeEventListener actually uses to find and remove the event
// listener.
options->signal()->AddAlgorithm(WTF::Bind(
options->signal()->AddAlgorithm(WTF::BindOnce(
[](EventTarget* event_target, const AtomicString& event_type,
const EventListener* listener, bool capture) {
event_target->removeEventListener(event_type, listener, capture);
@ -965,8 +965,8 @@ void EventTarget::EnqueueEvent(Event& event, TaskType task_type) {
event.async_task_context()->Schedule(context, event.type());
context->GetTaskRunner(task_type)->PostTask(
FROM_HERE,
WTF::Bind(&EventTarget::DispatchEnqueuedEvent, WrapPersistent(this),
WrapPersistent(&event), WrapPersistent(context)));
WTF::BindOnce(&EventTarget::DispatchEnqueuedEvent, WrapPersistent(this),
WrapPersistent(&event), WrapPersistent(context)));
}
void EventTarget::DispatchEnqueuedEvent(Event* event,

@ -235,8 +235,10 @@ static SlotChangeList& ActiveSlotChangeList() {
return *slot_change_list;
}
static void EnsureEnqueueMicrotask() {
if (ActiveMutationObservers().IsEmpty() && ActiveSlotChangeList().IsEmpty())
Microtask::EnqueueMicrotask(WTF::Bind(&MutationObserver::DeliverMutations));
if (ActiveMutationObservers().IsEmpty() && ActiveSlotChangeList().IsEmpty()) {
Microtask::EnqueueMicrotask(
WTF::BindOnce(&MutationObserver::DeliverMutations));
}
}
// static

@ -103,9 +103,9 @@ TEST_F(ScriptedAnimationControllerTest, EnqueueWithinTask) {
TaskOrderObserver observer;
Controller().EnqueueTask(observer.CreateTask(1));
Controller().EnqueueTask(WTF::Bind(&EnqueueTask,
WrapPersistent(&Controller()),
WTF::Unretained(&observer), 2));
Controller().EnqueueTask(WTF::BindOnce(&EnqueueTask,
WrapPersistent(&Controller()),
WTF::Unretained(&observer), 2));
Controller().EnqueueTask(observer.CreateTask(3));
EXPECT_EQ(0u, observer.Order().size());

@ -138,15 +138,16 @@ void ScriptedIdleTaskController::ScheduleCallback(
scoped_refptr<internal::IdleRequestCallbackWrapper> callback_wrapper,
uint32_t timeout_millis) {
scheduler_->PostIdleTask(
FROM_HERE, WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
callback_wrapper));
FROM_HERE,
WTF::BindOnce(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
callback_wrapper));
if (timeout_millis > 0) {
GetExecutionContext()
->GetTaskRunner(TaskType::kIdleTask)
->PostDelayedTask(
FROM_HERE,
WTF::Bind(&internal::IdleRequestCallbackWrapper::TimeoutFired,
callback_wrapper),
WTF::BindOnce(&internal::IdleRequestCallbackWrapper::TimeoutFired,
callback_wrapper),
base::Milliseconds(timeout_millis));
}
}
@ -250,8 +251,8 @@ void ScriptedIdleTaskController::ContextUnpaused() {
->GetTaskRunner(TaskType::kIdleTask)
->PostTask(
FROM_HERE,
WTF::Bind(&internal::IdleRequestCallbackWrapper::TimeoutFired,
callback_wrapper));
WTF::BindOnce(&internal::IdleRequestCallbackWrapper::TimeoutFired,
callback_wrapper));
}
pending_timeouts_.clear();
@ -261,8 +262,8 @@ void ScriptedIdleTaskController::ContextUnpaused() {
internal::IdleRequestCallbackWrapper::Create(idle_task.key, this);
scheduler_->PostIdleTask(
FROM_HERE,
WTF::Bind(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
callback_wrapper));
WTF::BindOnce(&internal::IdleRequestCallbackWrapper::IdleTaskFired,
callback_wrapper));
}
}

@ -31,7 +31,7 @@ ScriptPromise InternalsStorageAccess::setStorageAccess(
auto* raw_storage_access_automation = storage_access_automation.get();
raw_storage_access_automation->SetStorageAccess(
origin, embedding_origin, blocked,
WTF::Bind(
WTF::BindOnce(
// While we only really need |resolver|, we also take the
// mojo::Remote<> so that it remains alive after this function exits.
[](ScriptPromiseResolver* resolver,

@ -83,9 +83,9 @@ void AsyncFindBuffer::NextIteration(RangeInFlatTree* search_range,
->GetTaskRunner(TaskType::kInternalFindInPage)
.get(),
FROM_HERE,
WTF::Bind(&AsyncFindBuffer::Run, WrapWeakPersistent(this),
WrapWeakPersistent(search_range), search_text, options,
std::move(completeCallback)));
WTF::BindOnce(&AsyncFindBuffer::Run, WrapWeakPersistent(this),
WrapWeakPersistent(search_range), search_text, options,
std::move(completeCallback)));
}
} // namespace blink

@ -50,8 +50,8 @@ class FindTaskController::FindTask final : public GarbageCollected<FindTask> {
} else {
controller_->GetLocalFrame()
->GetTaskRunner(blink::TaskType::kInternalFindInPage)
->PostTask(FROM_HERE,
WTF::Bind(&FindTask::Invoke, WrapWeakPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&FindTask::Invoke,
WrapWeakPersistent(this)));
}
}

@ -304,8 +304,9 @@ bool TextFinder::FindInternal(int identifier,
if (options.run_synchronously_for_testing) {
Scroll(std::move(scroll_context));
} else {
scroll_task_.Reset(WTF::Bind(&TextFinder::Scroll, WrapWeakPersistent(this),
std::move(scroll_context)));
scroll_task_.Reset(WTF::BindOnce(&TextFinder::Scroll,
WrapWeakPersistent(this),
std::move(scroll_context)));
GetFrame()->GetDocument()->EnqueueAnimationFrameTask(
scroll_task_.callback());
}

@ -156,7 +156,7 @@ class FailingLoader final : public WebURLLoader {
client_ = client;
freezable_task_runner_handle_->GetTaskRunner()->PostTask(
FROM_HERE,
WTF::Bind(&FailingLoader::Fail, weak_ptr_factory_.GetWeakPtr()));
WTF::BindOnce(&FailingLoader::Fail, weak_ptr_factory_.GetWeakPtr()));
}
void Freeze(LoaderFreezeMode mode) override {
mode_ = mode;
@ -165,7 +165,7 @@ class FailingLoader final : public WebURLLoader {
}
freezable_task_runner_handle_->GetTaskRunner()->PostTask(
FROM_HERE,
WTF::Bind(&FailingLoader::Fail, weak_ptr_factory_.GetWeakPtr()));
WTF::BindOnce(&FailingLoader::Fail, weak_ptr_factory_.GetWeakPtr()));
}
void DidChangePriority(WebURLRequest::Priority, int) override {}
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunnerForBodyLoader()

@ -171,8 +171,8 @@ void IdleSpellCheckController::SetNeedsColdModeInvocation() {
: kColdModeTimerInterval;
cold_mode_timer_ = PostDelayedCancellableTask(
*GetWindow().GetTaskRunner(TaskType::kInternalDefault), FROM_HERE,
WTF::Bind(&IdleSpellCheckController::ColdModeTimerFired,
WrapPersistent(this)),
WTF::BindOnce(&IdleSpellCheckController::ColdModeTimerFired,
WrapPersistent(this)),
interval);
state_ = State::kColdModeTimerStarted;
}

@ -287,8 +287,8 @@ void SpellCheckRequester::DidCheck(int sequence) {
if (!request_queue_.IsEmpty()) {
timer_to_process_queued_request_ = PostCancellableTask(
*window_->GetTaskRunner(TaskType::kInternalDefault), FROM_HERE,
WTF::Bind(&SpellCheckRequester::TimerFiredToProcessQueuedRequest,
WrapPersistent(this)));
WTF::BindOnce(&SpellCheckRequester::TimerFiredToProcessQueuedRequest,
WrapPersistent(this)));
}
}

@ -181,9 +181,9 @@ void WebNode::SimulateClick() {
private_->GetExecutionContext()
->GetTaskRunner(TaskType::kUserInteraction)
->PostTask(FROM_HERE,
WTF::Bind(&Node::DispatchSimulatedClick,
WrapWeakPersistent(private_.Get()), nullptr,
SimulatedClickCreationScope::kFromUserAgent));
WTF::BindOnce(&Node::DispatchSimulatedClick,
WrapWeakPersistent(private_.Get()), nullptr,
SimulatedClickCreationScope::kFromUserAgent));
}
WebElementCollection WebNode::GetElementsByHTMLTagName(

@ -348,7 +348,7 @@ WebPagePopupImpl::WebPagePopupImpl(
/*is_embedded=*/false,
/*is_for_scalable_page=*/true)) {
DCHECK(popup_client_);
popup_widget_host_.set_disconnect_handler(WTF::Bind(
popup_widget_host_.set_disconnect_handler(WTF::BindOnce(
&WebPagePopupImpl::WidgetHostDisconnected, WTF::Unretained(this)));
if (auto* main_frame_widget = opener_web_view->MainFrameViewWidget()) {
if (auto* device_emulator = main_frame_widget->DeviceEmulator()) {
@ -421,7 +421,7 @@ WebPagePopupImpl::WebPagePopupImpl(
popup_client_->OwnerElement().getBoundingClientRect();
popup_widget_host_->ShowPopup(
initial_rect_, GetAnchorRectInScreen(),
WTF::Bind(&WebPagePopupImpl::DidShowPopup, WTF::Unretained(this)));
WTF::BindOnce(&WebPagePopupImpl::DidShowPopup, WTF::Unretained(this)));
should_defer_setting_window_rect_ = false;
widget_base_->SetPendingWindowRect(initial_rect_);
@ -622,7 +622,7 @@ void WebPagePopupImpl::SetWindowRect(const gfx::Rect& rect_in_screen) {
widget_base_->SetPendingWindowRect(window_rect);
popup_widget_host_->SetPopupBounds(
window_rect,
WTF::Bind(&WebPagePopupImpl::DidSetBounds, WTF::Unretained(this)));
WTF::BindOnce(&WebPagePopupImpl::DidSetBounds, WTF::Unretained(this)));
} else {
initial_rect_ = window_rect;
}

@ -377,8 +377,8 @@ bool WebPluginContainerImpl::IsMouseLocked() {
bool WebPluginContainerImpl::LockMouse(bool request_unadjusted_movement) {
if (Page* page = element_->GetDocument().GetPage()) {
bool res = page->GetPointerLockController().RequestPointerLock(
element_, WTF::Bind(&WebPluginContainerImpl::HandleLockMouseResult,
WrapWeakPersistent(this)));
element_, WTF::BindOnce(&WebPluginContainerImpl::HandleLockMouseResult,
WrapWeakPersistent(this)));
if (res) {
mouse_lock_lost_listener_ =
MakeGarbageCollected<MouseLockLostListener>(this);

@ -525,8 +525,9 @@ void WebViewImpl::CloseWindowSoon() {
->GetPageScheduler()
->GetAgentGroupScheduler()
.DefaultTaskRunner()
->PostTask(FROM_HERE, WTF::Bind(&WebViewImpl::DoDeferredCloseWindowSoon,
weak_ptr_factory_.GetWeakPtr()));
->PostTask(FROM_HERE,
WTF::BindOnce(&WebViewImpl::DoDeferredCloseWindowSoon,
weak_ptr_factory_.GetWeakPtr()));
}
void WebViewImpl::DoDeferredCloseWindowSoon() {
@ -576,7 +577,7 @@ WebViewImpl::WebViewImpl(
// corresponding browser-side `RenderViewHostImpl` (e.g. tests or
// printing), call `Close()` directly instead to delete `this`.
receiver_.set_disconnect_handler(
WTF::Bind(&WebViewImpl::MojoDisconnected, WTF::Unretained(this)));
WTF::BindOnce(&WebViewImpl::MojoDisconnected, WTF::Unretained(this)));
}
if (!web_view_client_)
DCHECK(!does_composite_);
@ -2966,7 +2967,7 @@ void WebViewImpl::Show(const LocalFrameToken& opener_frame_token,
local_main_frame_host_remote_->ShowCreatedWindow(
opener_frame_token, NavigationPolicyToDisposition(policy),
std::move(window_features), opened_by_user_gesture,
WTF::Bind(&WebViewImpl::DidShowCreatedWindow, WTF::Unretained(this)));
WTF::BindOnce(&WebViewImpl::DidShowCreatedWindow, WTF::Unretained(this)));
MainFrameDevToolsAgentImpl()->DidShowNewWindow();
}
@ -3018,13 +3019,13 @@ void WebViewImpl::SendUpdatedTargetURLToBrowser(const KURL& target_url) {
if (GetPage()->MainFrame()->IsLocalFrame()) {
DCHECK(local_main_frame_host_remote_);
local_main_frame_host_remote_->UpdateTargetURL(
target_url, WTF::Bind(&WebViewImpl::TargetURLUpdatedInBrowser,
WTF::Unretained(this)));
target_url, WTF::BindOnce(&WebViewImpl::TargetURLUpdatedInBrowser,
WTF::Unretained(this)));
} else {
DCHECK(remote_main_frame_host_remote_);
remote_main_frame_host_remote_->UpdateTargetURL(
target_url, WTF::Bind(&WebViewImpl::TargetURLUpdatedInBrowser,
WTF::Unretained(this)));
target_url, WTF::BindOnce(&WebViewImpl::TargetURLUpdatedInBrowser,
WTF::Unretained(this)));
}
}
@ -3884,7 +3885,7 @@ void WebViewImpl::MojoDisconnected() {
// process, and is used to release ownership of the corresponding
// RenderViewImpl instance. https://crbug.com/1000035.
GetPage()->GetAgentGroupScheduler().DefaultTaskRunner()->PostNonNestableTask(
FROM_HERE, WTF::Bind(&WebViewImpl::Close, WTF::Unretained(this)));
FROM_HERE, WTF::BindOnce(&WebViewImpl::Close, WTF::Unretained(this)));
}
void WebViewImpl::CreateRemoteMainFrame(

@ -60,8 +60,8 @@ class BodyConsumerBase : public GarbageCollected<BodyConsumerBase>,
template <typename T>
void ResolveLater(const T& object) {
task_runner_->PostTask(FROM_HERE,
WTF::Bind(&BodyConsumerBase::ResolveNow<T>,
WrapPersistent(this), object));
WTF::BindOnce(&BodyConsumerBase::ResolveNow<T>,
WrapPersistent(this), object));
}
void Trace(Visitor* visitor) const override {

@ -154,7 +154,7 @@ void BodyStreamBuffer::Init() {
Abort();
} else {
signal_->AddAlgorithm(
WTF::Bind(&BodyStreamBuffer::Abort, WrapWeakPersistent(this)));
WTF::BindOnce(&BodyStreamBuffer::Abort, WrapWeakPersistent(this)));
}
}
OnStateChange();
@ -236,8 +236,8 @@ void BodyStreamBuffer::StartLoading(FetchDataLoader* loader,
client->Abort();
return;
}
signal_->AddAlgorithm(
WTF::Bind(&FetchDataLoader::Client::Abort, WrapWeakPersistent(client)));
signal_->AddAlgorithm(WTF::BindOnce(&FetchDataLoader::Client::Abort,
WrapWeakPersistent(client)));
}
loader_ = loader;
auto* handle = ReleaseHandle(exception_state);

@ -196,8 +196,8 @@ class TeeHelper final : public GarbageCollected<TeeHelper>,
if (chunks_.IsEmpty() && tee_->GetPublicState() == PublicState::kClosed) {
// All data has been consumed.
execution_context_->GetTaskRunner(TaskType::kNetworking)
->PostTask(FROM_HERE,
WTF::Bind(&Destination::Close, WrapPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&Destination::Close,
WrapPersistent(this)));
}
return Result::kOk;
}

@ -83,8 +83,9 @@ class FetchDataLoaderAsBlobHandle final : public FetchDataLoader,
mime_type_ ? mime_type_ : "", /*content_disposition=*/"",
/*length_hint=*/0, std::move(handle),
mojo::PendingAssociatedRemote<mojom::blink::ProgressClient>(),
WTF::Bind(&FetchDataLoaderAsBlobHandle::FinishedCreatingFromDataPipe,
WrapWeakPersistent(this)));
WTF::BindOnce(
&FetchDataLoaderAsBlobHandle::FinishedCreatingFromDataPipe,
WrapWeakPersistent(this)));
}
void DidFetchDataLoadedDataPipe() override {

@ -953,7 +953,8 @@ ScriptPromise FetchManager::Fetch(ScriptState* script_state,
MakeGarbageCollected<Loader>(GetExecutionContext(), this, resolver,
request, &script_state->World(), signal);
loaders_.insert(loader);
signal->AddAlgorithm(WTF::Bind(&Loader::Abort, WrapWeakPersistent(loader)));
signal->AddAlgorithm(
WTF::BindOnce(&Loader::Abort, WrapWeakPersistent(loader)));
// TODO(ricea): Reject the Response body with AbortError, not TypeError.
loader->Start();
return promise;

@ -146,11 +146,11 @@ FetchRequestData* FetchRequestData::Create(
mojo::Remote<network::mojom::blink::ChunkedDataPipeGetter>>(
fetch_api_request->body.TakeStreamBody());
body_remote->set_disconnect_with_reason_handler(
WTF::Bind(SignalError, WrapPersistent(completion_notifier)));
WTF::BindOnce(SignalError, WrapPersistent(completion_notifier)));
auto* body_remote_raw = body_remote.get();
(*body_remote_raw)
->GetSize(WTF::Bind(SignalSize, std::move(body_remote),
WrapPersistent(completion_notifier)));
->GetSize(WTF::BindOnce(SignalSize, std::move(body_remote),
WrapPersistent(completion_notifier)));
(*body_remote_raw)->StartReading(std::move(writable));
} else {
request->SetBuffer(BodyStreamBuffer::Create(

@ -198,8 +198,8 @@ class DataPipeAndDataBytesConsumer final : public BytesConsumer {
data_pipe_getter->Read(
std::move(pipe_producer_handle),
WTF::Bind(&DataPipeAndDataBytesConsumer::DataPipeGetterCallback,
WrapWeakPersistent(this)));
WTF::BindOnce(&DataPipeAndDataBytesConsumer::DataPipeGetterCallback,
WrapWeakPersistent(this)));
DataPipeBytesConsumer::CompletionNotifier* completion_notifier =
nullptr;
data_pipe_consumer_ = MakeGarbageCollected<DataPipeBytesConsumer>(

@ -39,8 +39,8 @@ ScriptPromise WorkerInternalsFetch::getInitialResourcePriority(
KURL resource_url = url_test_helpers::ToKURL(url.Utf8());
DCHECK(worker_global);
auto callback = WTF::Bind(&WorkerInternalsFetch::ResolveResourcePriority,
WrapPersistent(resolver));
auto callback = WTF::BindOnce(&WorkerInternalsFetch::ResolveResourcePriority,
WrapPersistent(resolver));
ResourceFetcher::AddPriorityObserverForTesting(resource_url,
std::move(callback));

@ -176,7 +176,7 @@ void PublicURLManager::Resolve(
url_store_->ResolveAsURLLoaderFactory(
url, std::move(factory_receiver),
WTF::Bind(
WTF::BindOnce(
[](ExecutionContext* execution_context,
const absl::optional<base::UnguessableToken>&
unsafe_agent_cluster_id,
@ -249,7 +249,7 @@ void PublicURLManager::Resolve(
url_store_->ResolveForNavigation(
url, std::move(token_receiver),
WTF::Bind(
WTF::BindOnce(
[](ExecutionContext* execution_context,
const absl::optional<base::UnguessableToken>&
unsafe_agent_cluster_id) {

@ -135,7 +135,7 @@ ScriptPromise FragmentDirective::createSelectorDirective(
auto* generator = MakeGarbageCollected<TextFragmentSelectorGenerator>(frame);
generator->Generate(
*range_in_flat_tree,
WTF::Bind(
WTF::BindOnce(
[](ScriptPromiseResolver* resolver,
TextFragmentSelectorGenerator* generator,
const RangeInFlatTree* range, const TextFragmentSelector& selector,

@ -373,8 +373,8 @@ void TextFragmentAnchor::DidFindFirstMatch(
EnclosingBlock(range.StartPosition(), kCannotCrossEditingBoundary);
DCHECK(enclosing_block);
frame_->GetDocument()->EnqueueAnimationFrameTask(
WTF::Bind(&TextFragmentAnchor::FireBeforeMatchEvent, WrapPersistent(this),
WrapPersistent(&range)));
WTF::BindOnce(&TextFragmentAnchor::FireBeforeMatchEvent,
WrapPersistent(this), WrapPersistent(&range)));
state_ = kBeforeMatchEventQueued;
}

@ -62,7 +62,7 @@ class TextFragmentAnchorMetricsTest : public SimTest {
// When the beforematch event is not scheduled, a DCHECK will fail on
// BeginFrame() because no event was scheduled, so we schedule an empty task
// here.
GetDocument().EnqueueAnimationFrameTask(WTF::Bind([]() {}));
GetDocument().EnqueueAnimationFrameTask(WTF::BindOnce([]() {}));
Compositor().BeginFrame();
}

@ -75,7 +75,7 @@ class TextFragmentAnchorTest : public SimTest {
// When the beforematch event is not scheduled, a DCHECK will fail on
// BeginFrame() because no event was scheduled, so we schedule an empty task
// here.
GetDocument().EnqueueAnimationFrameTask(WTF::Bind([]() {}));
GetDocument().EnqueueAnimationFrameTask(WTF::BindOnce([]() {}));
Compositor().BeginFrame();
}

@ -164,10 +164,10 @@ void TextFragmentFinder::FindMatchInRange(String search_text,
bool word_end_bounded) {
find_buffer_runner_->FindMatchInRange(
search_range, search_text, kCaseInsensitive,
WTF::Bind(&TextFragmentFinder::OnFindMatchInRangeComplete,
WrapWeakPersistent(this), search_text,
WrapWeakPersistent(search_range), word_start_bounded,
word_end_bounded));
WTF::BindOnce(&TextFragmentFinder::OnFindMatchInRangeComplete,
WrapWeakPersistent(this), search_text,
WrapWeakPersistent(search_range), word_start_bounded,
word_end_bounded));
}
void TextFragmentFinder::FindPrefix() {

@ -141,7 +141,7 @@ String TextFragmentGenerationNavigationTest::GenerateSelector(
shared_highlighting::LinkGenerationError error) {
selector = generated_selector.ToString();
};
auto callback = WTF::Bind(lambda, std::ref(selector));
auto callback = WTF::BindOnce(lambda, std::ref(selector));
MakeGarbageCollected<TextFragmentSelectorGenerator>(GetDocument().GetFrame())
->Generate(selection_range, std::move(callback));

@ -204,8 +204,8 @@ void TextFragmentHandler::StartGeneratingForCurrentSelection() {
}
GetTextFragmentSelectorGenerator()->Generate(
*current_selection_range,
WTF::Bind(&TextFragmentHandler::DidFinishSelectorGeneration,
WrapWeakPersistent(this)));
WTF::BindOnce(&TextFragmentHandler::DidFinishSelectorGeneration,
WrapWeakPersistent(this)));
}
void TextFragmentHandler::Trace(Visitor* visitor) const {

@ -49,7 +49,7 @@ class TextFragmentHandlerTest : public SimTest {
// When the beforematch event is not scheduled, a DCHECK will fail on
// BeginFrame() because no event was scheduled, so we schedule an empty task
// here.
GetDocument().EnqueueAnimationFrameTask(WTF::Bind([]() {}));
GetDocument().EnqueueAnimationFrameTask(WTF::BindOnce([]() {}));
Compositor().BeginFrame();
}
@ -93,7 +93,7 @@ class TextFragmentHandlerTest : public SimTest {
callback_called = true;
};
auto callback =
WTF::Bind(lambda, std::ref(callback_called), std::ref(selector));
WTF::BindOnce(lambda, std::ref(callback_called), std::ref(selector));
GetTextFragmentHandler().RequestSelector(std::move(callback));
base::RunLoop().RunUntilIdle();
@ -109,8 +109,8 @@ class TextFragmentHandlerTest : public SimTest {
target_texts = fetched_target_texts;
callback_called = true;
};
auto callback =
WTF::Bind(lambda, std::ref(callback_called), std::ref(target_texts));
auto callback = WTF::BindOnce(lambda, std::ref(callback_called),
std::ref(target_texts));
GetTextFragmentHandler().ExtractTextFragmentsMatches(std::move(callback));
@ -126,8 +126,8 @@ class TextFragmentHandlerTest : public SimTest {
text_fragment_rect = fetched_text_fragment_rect;
callback_called = true;
};
auto callback = WTF::Bind(lambda, std::ref(callback_called),
std::ref(text_fragment_rect));
auto callback = WTF::BindOnce(lambda, std::ref(callback_called),
std::ref(text_fragment_rect));
GetTextFragmentHandler().ExtractFirstFragmentRect(std::move(callback));
@ -666,8 +666,8 @@ TEST_F(TextFragmentHandlerTest, SecondGenerationCrash) {
SetSelection(start, end);
auto callback =
WTF::Bind([](const TextFragmentSelector& selector,
shared_highlighting::LinkGenerationError error) {});
WTF::BindOnce([](const TextFragmentSelector& selector,
shared_highlighting::LinkGenerationError error) {});
MakeGarbageCollected<TextFragmentSelectorGenerator>(GetDocument().GetFrame())
->SetCallbackForTesting(std::move(callback));
@ -918,7 +918,7 @@ TEST_F(TextFragmentHandlerTest,
callback_called = true;
};
auto callback =
WTF::Bind(lambda, std::ref(callback_called), std::ref(selector));
WTF::BindOnce(lambda, std::ref(callback_called), std::ref(selector));
remote->RequestSelector(std::move(callback));
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(callback_called);

@ -97,7 +97,7 @@ class TextFragmentSelectorGeneratorTest : public SimTest {
callback_called = true;
};
auto callback =
WTF::Bind(lambda, std::ref(callback_called), std::ref(selector));
WTF::BindOnce(lambda, std::ref(callback_called), std::ref(selector));
CreateGenerator()->Generate(*MakeGarbageCollected<RangeInFlatTree>(
ToPositionInFlatTree(selected_start),
ToPositionInFlatTree(selected_end)),
@ -1815,7 +1815,7 @@ TEST_F(TextFragmentSelectorGeneratorTest, RemoveLayoutObjectAsync) {
selector = generated_selector.ToString();
callback_called = true;
};
auto callback = WTF::Bind(lambda, std::ref(finished), std::ref(selector));
auto callback = WTF::BindOnce(lambda, std::ref(finished), std::ref(selector));
TextFragmentSelectorGenerator* generator = CreateGenerator();
generator->Generate(*MakeGarbageCollected<RangeInFlatTree>(
@ -1836,7 +1836,7 @@ TEST_F(TextFragmentSelectorGeneratorTest, RemoveLayoutObjectAsync) {
EXPECT_EQ(generator->state_,
TextFragmentSelectorGenerator::SelectorState::kTestCandidate);
generator->did_find_match_callback_for_testing_ = WTF::Bind(
generator->did_find_match_callback_for_testing_ = WTF::BindOnce(
[](Element* target, bool is_unique) {
EXPECT_FALSE(is_unique);

@ -282,9 +282,9 @@ AttributionSrcLoader::CreateAndSendRequest(const KURL& src_url,
if (document->IsPrerendering()) {
document->AddPostPrerenderingActivationStep(
WTF::Bind(base::IgnoreResult(&AttributionSrcLoader::DoRegistration),
WrapPersistentIfNeeded(this), src_url, src_type,
associated_with_navigation));
WTF::BindOnce(base::IgnoreResult(&AttributionSrcLoader::DoRegistration),
WrapPersistentIfNeeded(this), src_url, src_type,
associated_with_navigation));
return nullptr;
}

@ -153,7 +153,7 @@ void ExecutionContextCSPDelegate::DispatchViolationEvent(
execution_context_->GetTaskRunner(TaskType::kNetworking)
->PostTask(
FROM_HERE,
WTF::Bind(
WTF::BindOnce(
&ExecutionContextCSPDelegate::DispatchViolationEventInternal,
WrapPersistent(this), WrapPersistent(&violation_data),
WrapPersistent(element)));

@ -538,8 +538,8 @@ void DOMWindow::InstallCoopAccessMonitor(
// TODO(arthursonzogni): Consider observing |accessing_main_frame| deletion
// instead.
monitor.reporter.set_disconnect_handler(
WTF::Bind(&DOMWindow::DisconnectCoopAccessMonitor,
WrapWeakPersistent(this), monitor.accessing_main_frame));
WTF::BindOnce(&DOMWindow::DisconnectCoopAccessMonitor,
WrapWeakPersistent(this), monitor.accessing_main_frame));
// As long as RenderDocument isn't shipped, it can exist a CoopAccessMonitor
// for the same |accessing_main_frame|, because it might now host a different

@ -578,12 +578,13 @@ base::OnceClosure Frame::ScheduleFormSubmission(
FormSubmission* form_submission) {
form_submit_navigation_task_ = PostCancellableTask(
*scheduler->GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE,
WTF::Bind(&FormSubmission::Navigate, WrapPersistent(form_submission)));
WTF::BindOnce(&FormSubmission::Navigate,
WrapPersistent(form_submission)));
form_submit_navigation_task_version_++;
return WTF::Bind(&Frame::CancelFormSubmissionWithVersion,
WrapWeakPersistent(this),
form_submit_navigation_task_version_);
return WTF::BindOnce(&Frame::CancelFormSubmissionWithVersion,
WrapWeakPersistent(this),
form_submit_navigation_task_version_);
}
void Frame::CancelFormSubmission() {

@ -116,8 +116,8 @@ void RunServeAsyncRequestsTask(scoped_refptr<base::TaskRunner> task_runner) {
// getting the platform's one. (crbug.com/751425)
WebURLLoaderMockFactory::GetSingletonInstance()->ServeAsynchronousRequests();
if (TestWebFrameClient::IsLoading()) {
task_runner->PostTask(FROM_HERE,
WTF::Bind(&RunServeAsyncRequestsTask, task_runner));
task_runner->PostTask(
FROM_HERE, WTF::BindOnce(&RunServeAsyncRequestsTask, task_runner));
} else {
test::ExitRunLoop();
}
@ -245,7 +245,7 @@ void PumpPendingRequestsForFrameToLoad(WebLocalFrame* frame) {
scoped_refptr<base::TaskRunner> task_runner =
frame->GetTaskRunner(blink::TaskType::kInternalTest);
task_runner->PostTask(FROM_HERE,
WTF::Bind(&RunServeAsyncRequestsTask, task_runner));
WTF::BindOnce(&RunServeAsyncRequestsTask, task_runner));
test::EnterRunLoop();
}

@ -210,8 +210,8 @@ void FullscreenController::EnterFullscreen(LocalFrame& frame,
if (!(request_type & FullscreenRequestType::kForCrossProcessDescendant)) {
frame.GetLocalFrameHostRemote().EnterFullscreen(
std::move(fullscreen_options),
WTF::Bind(&FullscreenController::EnterFullscreenCallback,
WTF::Unretained(this)));
WTF::BindOnce(&FullscreenController::EnterFullscreenCallback,
WTF::Unretained(this)));
}
if (state_ == State::kInitial)

@ -766,8 +766,8 @@ void LocalDOMWindow::DispatchWindowLoadEvent() {
// 'load' event asynchronously. crbug.com/569511.
if (ScopedEventQueue::Instance()->ShouldQueueEvents() && document_) {
document_->GetTaskRunner(TaskType::kNetworking)
->PostTask(FROM_HERE, WTF::Bind(&LocalDOMWindow::DispatchLoadEvent,
WrapPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&LocalDOMWindow::DispatchLoadEvent,
WrapPersistent(this)));
return;
}
DispatchLoadEvent();
@ -1089,10 +1089,10 @@ void LocalDOMWindow::SchedulePostMessage(PostedMessage* posted_message) {
GetTaskRunner(TaskType::kPostedMessage)
->PostTask(
FROM_HERE,
WTF::Bind(&LocalDOMWindow::DispatchPostMessage, WrapPersistent(this),
WrapPersistent(event),
std::move(posted_message->target_origin),
std::move(location), source->GetAgent()->cluster_id()));
WTF::BindOnce(&LocalDOMWindow::DispatchPostMessage,
WrapPersistent(this), WrapPersistent(event),
std::move(posted_message->target_origin),
std::move(location), source->GetAgent()->cluster_id()));
event->async_task_context()->Schedule(this, "postMessage");
}
@ -1852,8 +1852,8 @@ void LocalDOMWindow::queueMicrotask(V8VoidFunction* callback) {
callback->SetParentTaskId(tracker->RunningTaskAttributionId(script_state));
}
Microtask::EnqueueMicrotask(
WTF::Bind(&V8VoidFunction::InvokeAndReportException,
WrapPersistent(callback), nullptr));
WTF::BindOnce(&V8VoidFunction::InvokeAndReportException,
WrapPersistent(callback), nullptr));
}
bool LocalDOMWindow::originAgentCluster() const {

@ -495,8 +495,8 @@ LocalFrameMojoHandler::GetDevicePosture() {
device_posture_provider_service_->AddListenerAndGetCurrentPosture(
device_posture_receiver_.BindNewPipeAndPassRemote(task_runner),
WTF::Bind(&LocalFrameMojoHandler::OnPostureChanged,
WrapPersistent(this)));
WTF::BindOnce(&LocalFrameMojoHandler::OnPostureChanged,
WrapPersistent(this)));
return current_device_posture_;
}
@ -1028,7 +1028,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld(
mojom::blink::UserActivationOption::kDoNotActivate,
mojom::blink::EvaluationTiming::kSynchronous,
mojom::blink::LoadEventBlockingOption::kDoNotBlock,
WTF::Bind(
WTF::BindOnce(
[](JavaScriptExecuteRequestInIsolatedWorldCallback callback,
absl::optional<base::Value> value, base::TimeTicks start_time) {
std::move(callback).Run(value ? std::move(*value) : base::Value());

@ -222,9 +222,9 @@ ScriptPromise NavigatorUAData::getHighEntropyValues(
execution_context->GetTaskRunner(TaskType::kPermission)
->PostTask(
FROM_HERE,
WTF::Bind([](ScriptPromiseResolver* resolver,
UADataValues* values) { resolver->Resolve(values); },
WrapPersistent(resolver), WrapPersistent(values)));
WTF::BindOnce([](ScriptPromiseResolver* resolver,
UADataValues* values) { resolver->Resolve(values); },
WrapPersistent(resolver), WrapPersistent(values)));
return promise;
}

@ -337,8 +337,8 @@ void PausableScriptExecutor::PostExecuteAndDestroySelf(
ExecutionContext* context) {
task_handle_ = PostCancellableTask(
*context->GetTaskRunner(TaskType::kJavascriptTimerImmediate), FROM_HERE,
WTF::Bind(&PausableScriptExecutor::ExecuteAndDestroySelf,
WrapPersistent(this)));
WTF::BindOnce(&PausableScriptExecutor::ExecuteAndDestroySelf,
WrapPersistent(this)));
}
void PausableScriptExecutor::ExecuteAndDestroySelf() {
@ -375,8 +375,8 @@ void PausableScriptExecutor::ExecuteAndDestroySelf() {
keep_alive_ = this;
MakeGarbageCollected<PromiseAggregator>(
script_state_, results,
WTF::Bind(&PausableScriptExecutor::HandleResults,
WrapWeakPersistent(this)));
WTF::BindOnce(&PausableScriptExecutor::HandleResults,
WrapWeakPersistent(this)));
break;
case mojom::blink::PromiseResultOption::kDoNotWait:

@ -191,8 +191,8 @@ void PendingBeaconDispatcher::ScheduleDispatchNextBundledBeacons() {
// this class and members should not outlive the Document (ExecutionContext).
task_handle_ = PostNonNestableDelayedCancellableTask(
*task_runner, FROM_HERE,
WTF::Bind(&PendingBeaconDispatcher::OnDispatchBeaconsAndRepeat,
WrapWeakPersistent(this), start_index),
WTF::BindOnce(&PendingBeaconDispatcher::OnDispatchBeaconsAndRepeat,
WrapWeakPersistent(this), start_index),
delayed);
}

@ -30,8 +30,8 @@ void PlatformEventController::StartUpdating() {
if (HasLastData() && !update_callback_handle_.IsActive()) {
update_callback_handle_ = PostCancellableTask(
*window_->GetTaskRunner(TaskType::kInternalDefault), FROM_HERE,
WTF::Bind(&PlatformEventController::UpdateCallback,
WrapWeakPersistent(this)));
WTF::BindOnce(&PlatformEventController::UpdateCallback,
WrapWeakPersistent(this)));
}
RegisterWithDispatcher();

@ -40,9 +40,9 @@ void RemoteDOMWindow::SchedulePostMessage(PostedMessage* posted_message) {
// further delaying postMessage forwarding until after the next BeginFrame.
posted_message->source
->GetTaskRunner(TaskType::kInternalPostMessageForwarding)
->PostTask(FROM_HERE, WTF::Bind(&RemoteDOMWindow::ForwardPostMessage,
WrapPersistent(this),
WrapPersistent(posted_message)));
->PostTask(FROM_HERE, WTF::BindOnce(&RemoteDOMWindow::ForwardPostMessage,
WrapPersistent(this),
WrapPersistent(posted_message)));
}
void RemoteDOMWindow::ForwardPostMessage(PostedMessage* posted_message) {

@ -54,8 +54,9 @@ void ReportingObserver::QueueReport(Report* report) {
// batch.
if (report_queue_.size() == 1) {
execution_context_->GetTaskRunner(TaskType::kMiscPlatformAPI)
->PostTask(FROM_HERE, WTF::Bind(&ReportingObserver::ReportToCallback,
WrapWeakPersistent(this)));
->PostTask(FROM_HERE,
WTF::BindOnce(&ReportingObserver::ReportToCallback,
WrapWeakPersistent(this)));
}
}

@ -2848,9 +2848,9 @@ void WebFrameWidgetImpl::AutoscrollEnd() {
void WebFrameWidgetImpl::DidMeaningfulLayout(WebMeaningfulLayout layout_type) {
if (layout_type == blink::WebMeaningfulLayout::kVisuallyNonEmpty) {
NotifyPresentationTime(
WTF::Bind(&WebFrameWidgetImpl::PresentationCallbackForMeaningfulLayout,
WrapWeakPersistent(this)));
NotifyPresentationTime(WTF::BindOnce(
&WebFrameWidgetImpl::PresentationCallbackForMeaningfulLayout,
WrapWeakPersistent(this)));
}
ForEachLocalFrameControlledByWidget(
@ -3035,9 +3035,9 @@ class ReportTimeSwapPromise : public cc::SwapPromise {
if (widget && widget->widget_base_) {
widget->widget_base_->AddPresentationCallback(
frame_token,
WTF::Bind(&RunCallbackAfterPresentation,
std::move(callbacks.presentation_time_callback),
swap_time));
WTF::BindOnce(&RunCallbackAfterPresentation,
std::move(callbacks.presentation_time_callback),
swap_time));
ReportTime(std::move(callbacks.swap_time_callback), swap_time);
#if BUILDFLAG(IS_MAC)
@ -4439,8 +4439,8 @@ void WebFrameWidgetImpl::SetWindowRect(const gfx::Rect& requested_rect,
DCHECK(ForMainFrame());
SetPendingWindowRect(adjusted_rect);
View()->SendWindowRectToMainFrameHost(
requested_rect, WTF::Bind(&WebFrameWidgetImpl::AckPendingWindowRect,
WrapWeakPersistent(this)));
requested_rect, WTF::BindOnce(&WebFrameWidgetImpl::AckPendingWindowRect,
WrapWeakPersistent(this)));
}
void WebFrameWidgetImpl::SetWindowRectSynchronouslyForTesting(

@ -577,9 +577,9 @@ void EnqueueEvent(const AtomicString& type,
Document& document,
FullscreenRequestType request_type) {
const AtomicString& adjusted_type = AdjustEventType(type, request_type);
document.EnqueueAnimationFrameTask(WTF::Bind(FireEvent, adjusted_type,
WrapWeakPersistent(&element),
WrapWeakPersistent(&document)));
document.EnqueueAnimationFrameTask(
WTF::BindOnce(FireEvent, adjusted_type, WrapWeakPersistent(&element),
WrapWeakPersistent(&document)));
}
} // anonymous namespace
@ -745,7 +745,7 @@ void Fullscreen::DidResolveEnterFullscreenRequest(Document& document,
// but must still not synchronously change the fullscreen element. Instead
// enqueue a microtask to continue.
if (RequestFullscreenScope::RunningRequestFullscreen()) {
Microtask::EnqueueMicrotask(WTF::Bind(
Microtask::EnqueueMicrotask(WTF::BindOnce(
[](Document* document, bool granted) {
DCHECK(document);
DidResolveEnterFullscreenRequest(*document, granted);
@ -971,8 +971,8 @@ ScriptPromise Fullscreen::ExitFullscreen(Document& doc,
// will change script-observable state (document.fullscreenElement)
// synchronously, so we have to continue asynchronously.
Microtask::EnqueueMicrotask(
WTF::Bind(ContinueExitFullscreen, WrapPersistent(&doc),
WrapPersistent(resolver), false /* resize */));
WTF::BindOnce(ContinueExitFullscreen, WrapPersistent(&doc),
WrapPersistent(resolver), false /* resize */));
}
return promise;
}

@ -300,9 +300,10 @@ bool CanvasAsyncBlobCreator::EncodeImage(const double& quality) {
void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
if (!static_bitmap_image_loaded_) {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::CreateNullAndReturnResult,
WrapPersistent(this)));
->PostTask(
FROM_HERE,
WTF::BindOnce(&CanvasAsyncBlobCreator::CreateNullAndReturnResult,
WrapPersistent(this)));
return;
}
// Webp encoder does not support progressive encoding. We also don't use idle
@ -327,18 +328,18 @@ void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
// So we just directly encode images on the worker thread.
if (!EncodeImage(quality)) {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::CreateNullAndReturnResult,
WrapPersistent(this)));
->PostTask(FROM_HERE,
WTF::BindOnce(
&CanvasAsyncBlobCreator::CreateNullAndReturnResult,
WrapPersistent(this)));
return;
}
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::CreateBlobAndReturnResult,
WrapPersistent(this)));
WTF::BindOnce(&CanvasAsyncBlobCreator::CreateBlobAndReturnResult,
WrapPersistent(this)));
} else {
worker_pool::PostTask(
@ -354,8 +355,8 @@ void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
// There's no risk of concurrency as both tasks are on the same thread.
PostDelayedTaskToCurrentThread(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::IdleTaskStartTimeoutEvent,
WrapPersistent(this), quality),
WTF::BindOnce(&CanvasAsyncBlobCreator::IdleTaskStartTimeoutEvent,
WrapPersistent(this), quality),
kIdleTaskStartTimeoutDelayMs);
}
}
@ -363,8 +364,8 @@ void CanvasAsyncBlobCreator::ScheduleAsyncBlobCreation(const double& quality) {
void CanvasAsyncBlobCreator::ScheduleInitiateEncoding(double quality) {
schedule_idle_task_start_time_ = base::TimeTicks::Now();
ThreadScheduler::Current()->PostIdleTask(
FROM_HERE, WTF::Bind(&CanvasAsyncBlobCreator::InitiateEncoding,
WrapPersistent(this), quality));
FROM_HERE, WTF::BindOnce(&CanvasAsyncBlobCreator::InitiateEncoding,
WrapPersistent(this), quality));
}
void CanvasAsyncBlobCreator::InitiateEncoding(double quality,
@ -397,8 +398,8 @@ void CanvasAsyncBlobCreator::IdleEncodeRows(base::TimeTicks deadline) {
if (IsEncodeRowDeadlineNearOrPassed(deadline, src_data_.width())) {
num_rows_completed_ = y;
ThreadScheduler::Current()->PostIdleTask(
FROM_HERE, WTF::Bind(&CanvasAsyncBlobCreator::IdleEncodeRows,
WrapPersistent(this)));
FROM_HERE, WTF::BindOnce(&CanvasAsyncBlobCreator::IdleEncodeRows,
WrapPersistent(this)));
return;
}
@ -416,9 +417,10 @@ void CanvasAsyncBlobCreator::IdleEncodeRows(base::TimeTicks deadline) {
RecordCompleteEncodingTimeHistogram(mime_type_, elapsed_time);
if (IsCreateBlobDeadlineNearOrPassed(deadline)) {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::CreateBlobAndReturnResult,
WrapPersistent(this)));
->PostTask(
FROM_HERE,
WTF::BindOnce(&CanvasAsyncBlobCreator::CreateBlobAndReturnResult,
WrapPersistent(this)));
} else {
CreateBlobAndReturnResult();
}
@ -457,15 +459,15 @@ void CanvasAsyncBlobCreator::CreateBlobAndReturnResult() {
if (function_type_ == kHTMLCanvasToBlobCallback) {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback_.Get()), nullptr,
WrapPersistent(result_blob)));
WTF::BindOnce(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback_.Get()), nullptr,
WrapPersistent(result_blob)));
} else {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&ScriptPromiseResolver::Resolve<Blob*>,
WrapPersistent(script_promise_resolver_.Get()),
WrapPersistent(result_blob)));
WTF::BindOnce(&ScriptPromiseResolver::Resolve<Blob*>,
WrapPersistent(script_promise_resolver_.Get()),
WrapPersistent(result_blob)));
}
RecordScaledDurationHistogram(mime_type_,
@ -485,8 +487,8 @@ void CanvasAsyncBlobCreator::CreateBlobAndReturnResult() {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::RecordIdentifiabilityMetric,
WrapPersistent(this)));
WTF::BindOnce(&CanvasAsyncBlobCreator::RecordIdentifiabilityMetric,
WrapPersistent(this)));
} else {
// RecordIdentifiabilityMetric needs a reference to image_, and will run
// dispose itself. So here we only call dispose if not recording the metric.
@ -520,16 +522,17 @@ void CanvasAsyncBlobCreator::CreateNullAndReturnResult() {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback_.Get()), nullptr, nullptr));
WTF::BindOnce(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback_.Get()), nullptr, nullptr));
} else {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&ScriptPromiseResolver::Reject<DOMException*>,
WrapPersistent(script_promise_resolver_.Get()),
WrapPersistent(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kEncodingError,
"Encoding of the source image has failed."))));
->PostTask(
FROM_HERE,
WTF::BindOnce(&ScriptPromiseResolver::Reject<DOMException*>,
WrapPersistent(script_promise_resolver_.Get()),
WrapPersistent(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kEncodingError,
"Encoding of the source image has failed."))));
}
// Avoid unwanted retention, see dispose().
Dispose();
@ -584,8 +587,8 @@ void CanvasAsyncBlobCreator::IdleTaskStartTimeoutEvent(double quality) {
// Even if the task started quickly, we still want to ensure completion
PostDelayedTaskToCurrentThread(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::IdleTaskCompleteTimeoutEvent,
WrapPersistent(this)),
WTF::BindOnce(&CanvasAsyncBlobCreator::IdleTaskCompleteTimeoutEvent,
WrapPersistent(this)),
kIdleTaskCompleteTimeoutDelayMs);
} else if (idle_task_status_ == kIdleTaskNotStarted) {
// If the idle task does not start after a delay threshold, we will
@ -599,8 +602,9 @@ void CanvasAsyncBlobCreator::IdleTaskStartTimeoutEvent(double quality) {
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::ForceEncodeRowsOnCurrentThread,
WrapPersistent(this)));
WTF::BindOnce(
&CanvasAsyncBlobCreator::ForceEncodeRowsOnCurrentThread,
WrapPersistent(this)));
} else {
// Failing in initialization of encoder
SignalAlternativeCodePathFinishedForTesting();
@ -622,10 +626,10 @@ void CanvasAsyncBlobCreator::IdleTaskCompleteTimeoutEvent() {
DCHECK(mime_type_ == kMimeTypePng || mime_type_ == kMimeTypeJpeg);
context_->GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(
FROM_HERE,
WTF::Bind(&CanvasAsyncBlobCreator::ForceEncodeRowsOnCurrentThread,
WrapPersistent(this)));
->PostTask(FROM_HERE,
WTF::BindOnce(
&CanvasAsyncBlobCreator::ForceEncodeRowsOnCurrentThread,
WrapPersistent(this)));
} else {
DCHECK(idle_task_status_ == kIdleTaskFailed ||
idle_task_status_ == kIdleTaskCompleted);

@ -110,8 +110,9 @@ class MockCanvasAsyncBlobCreatorWithoutComplete
void ScheduleInitiateEncoding(double quality) override {
PostDelayedTaskToCurrentThread(
FROM_HERE,
WTF::Bind(&MockCanvasAsyncBlobCreatorWithoutComplete::InitiateEncoding,
WrapPersistent(this), quality, base::TimeTicks::Max()),
WTF::BindOnce(
&MockCanvasAsyncBlobCreatorWithoutComplete::InitiateEncoding,
WrapPersistent(this), quality, base::TimeTicks::Max()),
/*delay_ms=*/0);
}

@ -1101,8 +1101,8 @@ void HTMLCanvasElement::toBlob(V8BlobCallback* callback,
GetDocument()
.GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback), nullptr, nullptr));
WTF::BindOnce(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback), nullptr, nullptr));
return;
}
@ -1139,8 +1139,8 @@ void HTMLCanvasElement::toBlob(V8BlobCallback* callback,
GetDocument()
.GetTaskRunner(TaskType::kCanvasBlobSerialization)
->PostTask(FROM_HERE,
WTF::Bind(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback), nullptr, nullptr));
WTF::BindOnce(&V8BlobCallback::InvokeAndReportException,
WrapPersistent(callback), nullptr, nullptr));
}
}
@ -1642,7 +1642,7 @@ void HTMLCanvasElement::UpdateMemoryUsage() {
NoAllocDirectCallHost* nadc_host =
context_ ? context_->AsNoAllocDirectCallHost() : nullptr;
if (nadc_host) {
nadc_host->PostDeferrableAction(WTF::Bind(
nadc_host->PostDeferrableAction(WTF::BindOnce(
[](intptr_t delta_bytes) {
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
delta_bytes);

@ -95,7 +95,7 @@ TEST(CustomElementReactionQueueTest, clear_duringInvoke) {
}
{
HeapVector<Member<Command>> commands;
commands.push_back(MakeGarbageCollected<Call>(WTF::Bind(
commands.push_back(MakeGarbageCollected<Call>(WTF::BindOnce(
[](CustomElementReactionQueue* queue, Element&) { queue->Clear(); },
WrapPersistent(queue))));
queue->Add(*MakeGarbageCollected<TestReaction>(std::move(commands)));

@ -94,8 +94,8 @@ void CustomElementReactionStack::EnqueueToBackupQueue(
// If the processing the backup element queue is not set:
if (!backup_queue_ || backup_queue_->IsEmpty()) {
Microtask::EnqueueMicrotask(
WTF::Bind(&CustomElementReactionStack::InvokeBackupQueue,
Persistent<CustomElementReactionStack>(this)));
WTF::BindOnce(&CustomElementReactionStack::InvokeBackupQueue,
Persistent<CustomElementReactionStack>(this)));
}
Enqueue(backup_queue_, element, reaction);

@ -557,8 +557,8 @@ void HTMLFencedFrameElement::CreateDelegateAndNavigate() {
return;
if (GetDocument().IsPrerendering()) {
GetDocument().AddPostPrerenderingActivationStep(
WTF::Bind(&HTMLFencedFrameElement::CreateDelegateAndNavigate,
WrapWeakPersistent(this)));
WTF::BindOnce(&HTMLFencedFrameElement::CreateDelegateAndNavigate,
WrapWeakPersistent(this)));
return;
}

@ -280,11 +280,11 @@ void ColorChooserPopupUIController::OpenEyeDropper() {
frame_->GetBrowserInterfaceBroker().GetInterface(
eye_dropper_chooser_.BindNewPipeAndPassReceiver(
frame_->GetTaskRunner(TaskType::kUserInteraction)));
eye_dropper_chooser_.set_disconnect_handler(WTF::Bind(
eye_dropper_chooser_.set_disconnect_handler(WTF::BindOnce(
&ColorChooserPopupUIController::EndChooser, WrapWeakPersistent(this)));
eye_dropper_chooser_->Choose(
WTF::Bind(&ColorChooserPopupUIController::EyeDropperResponseHandler,
WrapWeakPersistent(this)));
WTF::BindOnce(&ColorChooserPopupUIController::EyeDropperResponseHandler,
WrapWeakPersistent(this)));
}
void ColorChooserPopupUIController::OpenSystemColorChooser() {

@ -90,7 +90,7 @@ void ColorChooserUIController::OpenColorChooser() {
frame_->DomWindow()->GetExecutionContext()->GetTaskRunner(
TaskType::kUserInteraction)),
client_->CurrentColor().Rgb(), client_->Suggestions());
receiver_.set_disconnect_handler(WTF::Bind(
receiver_.set_disconnect_handler(WTF::BindOnce(
&ColorChooserUIController::EndChooser, WrapWeakPersistent(this)));
}
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC)

@ -85,8 +85,8 @@ void ExternalDateTimeChooser::OpenDateTimeChooser(
date_time_dialog_value->suggestions.push_back(suggestion->Clone());
}
auto response_callback = WTF::Bind(&ExternalDateTimeChooser::ResponseHandler,
WrapPersistent(this));
auto response_callback = WTF::BindOnce(
&ExternalDateTimeChooser::ResponseHandler, WrapPersistent(this));
GetDateTimeChooser(frame).OpenDateTimeDialog(
std::move(date_time_dialog_value), std::move(response_callback));
}

@ -191,8 +191,8 @@ void ExternalPopupMenu::UpdateFromElement(UpdateReason reason) {
needs_update_ = true;
owner_element_->GetDocument()
.GetTaskRunner(TaskType::kUserInteraction)
->PostTask(FROM_HERE, WTF::Bind(&ExternalPopupMenu::Update,
WrapPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&ExternalPopupMenu::Update,
WrapPersistent(this)));
break;
case kByStyleChange:

@ -80,10 +80,10 @@ bool FileChooser::OpenFileChooser(ChromeClientImpl& chrome_client_impl) {
frame->GetBrowserInterfaceBroker().GetInterface(
file_chooser_.BindNewPipeAndPassReceiver());
file_chooser_.set_disconnect_handler(
WTF::Bind(&FileChooser::DidCloseChooser, WTF::Unretained(this)));
WTF::BindOnce(&FileChooser::DidCloseChooser, WTF::Unretained(this)));
file_chooser_->OpenFileChooser(
params_.Clone(),
WTF::Bind(&FileChooser::DidChooseFiles, WTF::Unretained(this)));
WTF::BindOnce(&FileChooser::DidChooseFiles, WTF::Unretained(this)));
// Should be released on file choosing or connection error.
AddRef();
@ -100,10 +100,10 @@ void FileChooser::EnumerateChosenDirectory() {
frame->GetBrowserInterfaceBroker().GetInterface(
file_chooser_.BindNewPipeAndPassReceiver());
file_chooser_.set_disconnect_handler(
WTF::Bind(&FileChooser::DidCloseChooser, WTF::Unretained(this)));
WTF::BindOnce(&FileChooser::DidCloseChooser, WTF::Unretained(this)));
file_chooser_->EnumerateChosenDirectory(
std::move(params_->selected_files[0]),
WTF::Bind(&FileChooser::DidChooseFiles, WTF::Unretained(this)));
WTF::BindOnce(&FileChooser::DidChooseFiles, WTF::Unretained(this)));
// Should be released on file choosing or connection error.
AddRef();

@ -616,9 +616,10 @@ void FormController::RestoreControlStateOnUpgrade(ListedElement& control) {
void FormController::ScheduleRestore() {
document_->GetTaskRunner(TaskType::kInternalLoading)
->PostTask(FROM_HERE,
WTF::Bind(&FormController::RestoreAllControlsInDocumentOrder,
WrapPersistent(this)));
->PostTask(
FROM_HERE,
WTF::BindOnce(&FormController::RestoreAllControlsInDocumentOrder,
WrapPersistent(this)));
}
void FormController::RestoreImmediately() {

@ -1471,8 +1471,8 @@ void HTMLInputElement::DefaultEventHandler(Event& evt) {
if (type() == input_type_names::kSearch) {
GetDocument()
.GetTaskRunner(TaskType::kUserInteraction)
->PostTask(FROM_HERE, WTF::Bind(&HTMLInputElement::OnSearch,
WrapPersistent(this)));
->PostTask(FROM_HERE, WTF::BindOnce(&HTMLInputElement::OnSearch,
WrapPersistent(this)));
}
// Form submission finishes editing, just as loss of focus does.
// If there was a change, send the event now.

@ -563,8 +563,8 @@ void ListedElement::SetNeedsValidityCheck() {
element.GetDocument()
.GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(FROM_HERE,
WTF::Bind(&ListedElement::UpdateVisibleValidationMessage,
WrapPersistent(this)));
WTF::BindOnce(&ListedElement::UpdateVisibleValidationMessage,
WrapPersistent(this)));
}
}

@ -106,8 +106,8 @@ void SearchInputType::StartSearchEventTimer() {
GetElement()
.GetDocument()
.GetTaskRunner(TaskType::kUserInteraction)
->PostTask(FROM_HERE, WTF::Bind(&HTMLInputElement::OnSearch,
WrapPersistent(&GetElement())));
->PostTask(FROM_HERE, WTF::BindOnce(&HTMLInputElement::OnSearch,
WrapPersistent(&GetElement())));
return;
}

@ -1062,8 +1062,9 @@ void ListBoxSelectType::ScrollToOption(HTMLOptionElement* option) {
if (!has_pending_task) {
select_->GetDocument()
.GetTaskRunner(TaskType::kUserInteraction)
->PostTask(FROM_HERE, WTF::Bind(&ListBoxSelectType::ScrollToOptionTask,
WrapPersistent(this)));
->PostTask(FROM_HERE,
WTF::BindOnce(&ListBoxSelectType::ScrollToOptionTask,
WrapPersistent(this)));
}
}

@ -176,8 +176,8 @@ void HTMLDetailsElement::ParseAttribute(
// Dispatch toggle event asynchronously.
pending_event_ = PostCancellableTask(
*GetDocument().GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE,
WTF::Bind(&HTMLDetailsElement::DispatchPendingEvent,
WrapPersistent(this), params.reason));
WTF::BindOnce(&HTMLDetailsElement::DispatchPendingEvent,
WrapPersistent(this), params.reason));
Element* content = EnsureUserAgentShadowRoot().getElementById(
shadow_element_names::kIdDetailsContent);

@ -901,7 +901,7 @@ void HTMLFrameOwnerElement::MaybeSetTimeoutToStartFrameLoading(
.GetTaskRunner(TaskType::kInternalLoading)
->PostDelayedTask(
FROM_HERE,
WTF::Bind(
WTF::BindOnce(
base::IgnoreResult(&HTMLFrameOwnerElement::LoadImmediatelyIfLazy),
WrapWeakPersistent(this)),
timeout_ms);

@ -329,7 +329,7 @@ void HTMLLinkElement::ScheduleEvent() {
.GetTaskRunner(TaskType::kDOMManipulation)
->PostTask(
FROM_HERE,
WTF::Bind(
WTF::BindOnce(
&HTMLLinkElement::DispatchPendingEvent, WrapPersistent(this),
std::make_unique<IncrementLoadEventDelayCount>(GetDocument())));
}

@ -139,8 +139,8 @@ void HTMLSourceElement::ScheduleErrorEvent() {
pending_error_event_ = PostCancellableTask(
*GetDocument().GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE,
WTF::Bind(&HTMLSourceElement::DispatchPendingEvent,
WrapPersistent(this)));
WTF::BindOnce(&HTMLSourceElement::DispatchPendingEvent,
WrapPersistent(this)));
}
void HTMLSourceElement::CancelPendingErrorEvent() {

@ -136,7 +136,7 @@ void HTMLStyleElement::NotifyLoadedSheetAndAllCriticalSubresources(
.GetTaskRunner(TaskType::kNetworking)
->PostTask(
FROM_HERE,
WTF::Bind(
WTF::BindOnce(
&HTMLStyleElement::DispatchPendingEvent, WrapPersistent(this),
std::make_unique<IncrementLoadEventDelayCount>(GetDocument()),
is_load_event));

Some files were not shown because too many files have changed in this diff Show More