Flutter Engine
The Flutter Engine
testing
post_task_sync.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "flutter/testing/post_task_sync.h"
6
7
#include "flutter/fml/synchronization/waitable_event.h"
8
9
namespace
flutter
{
10
namespace
testing {
11
12
void
PostTaskSync
(
const
fml::RefPtr<fml::TaskRunner>
& task_runner,
13
const
std::function
<
void
()>&
function
) {
14
fml::AutoResetWaitableEvent
latch;
15
task_runner->
PostTask
([&] {
16
function
();
17
latch.
Signal
();
18
});
19
latch.
Wait
();
20
}
21
22
}
// namespace testing
23
}
// namespace flutter
fml::AutoResetWaitableEvent
Definition:
waitable_event.h:28
fml::AutoResetWaitableEvent::Wait
void Wait()
Definition:
waitable_event.cc:72
fml::AutoResetWaitableEvent::Signal
void Signal()
Definition:
waitable_event.cc:61
fml::RefPtr< fml::TaskRunner >
fml::TaskRunner::PostTask
virtual void PostTask(const fml::closure &task) override
Definition:
task_runner.cc:24
function
Dart_NativeFunction function
Definition:
fuchsia.cc:51
flutter::testing::PostTaskSync
void PostTaskSync(const fml::RefPtr< fml::TaskRunner > &task_runner, const std::function< void()> &function)
Definition:
post_task_sync.cc:12
flutter
Definition:
asset_manager.cc:10
Generated on Sun Jun 23 2024 21:55:19 for Flutter Engine by
1.9.4