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
9namespace flutter {
10namespace testing {
11
12void PostTaskSync(const fml::RefPtr<fml::TaskRunner>& task_runner,
13 const std::function<void()>& function) {
14 fml::AutoResetWaitableEvent latch;
15 task_runner->PostTask(task: [&] {
16 function();
17 latch.Signal();
18 });
19 latch.Wait();
20}
21
22} // namespace testing
23} // namespace flutter
24

source code of flutter_engine/flutter/testing/post_task_sync.cc

Morty Proxy This is a proxified and sanitized view of the page, visit original site.