Chinmay Garde 0b406c3de3
Copy the Flutter Runner from //topaz into the engine. (#8886)
Build rules and include paths have been updated as necessary.
No other functional change.
2019-05-07 17:24:18 -07:00

37 lines
842 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "loop.h"
#include <lib/async-loop/loop.h>
#include "task_observers.h"
namespace flutter_runner {
namespace {
static void LoopEpilogue(async_loop_t*, void*) {
ExecuteAfterTaskObservers();
}
constexpr async_loop_config_t kAttachedLoopConfig = {
.make_default_for_current_thread = true,
.epilogue = &LoopEpilogue,
};
constexpr async_loop_config_t kDetachedLoopConfig = {
.make_default_for_current_thread = false,
.epilogue = &LoopEpilogue,
};
} // namespace
async::Loop* MakeObservableLoop(bool attachToThread) {
return new async::Loop(
&(attachToThread ? kAttachedLoopConfig : kDetachedLoopConfig));
}
} // namespace flutter_runner