Flutter Engine
loop.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 "loop.h"
6 
7 #include <lib/async-loop/loop.h>
8 #include <lib/async/default.h>
9 
10 #include "task_observers.h"
11 
12 namespace flutter_runner {
13 
14 namespace {
15 
16 static void LoopEpilogue(async_loop_t*, void*) {
18 }
19 
20 constexpr async_loop_config_t kAttachedLoopConfig = {
21  .default_accessors =
22  {
23  .getter = async_get_default_dispatcher,
24  .setter = async_set_default_dispatcher,
25  },
26  .make_default_for_current_thread = true,
27  .epilogue = &LoopEpilogue,
28 };
29 
30 constexpr async_loop_config_t kDetachedLoopConfig = {
31  .default_accessors =
32  {
33  .getter = async_get_default_dispatcher,
34  .setter = async_set_default_dispatcher,
35  },
36  .make_default_for_current_thread = false,
37  .epilogue = &LoopEpilogue,
38 };
39 
40 } // namespace
41 
42 async::Loop* MakeObservableLoop(bool attachToThread) {
43  return new async::Loop(
44  &(attachToThread ? kAttachedLoopConfig : kDetachedLoopConfig));
45 }
46 
47 } // namespace flutter_runner
void ExecuteAfterTaskObservers()
async::Loop * MakeObservableLoop(bool attachToThread)
Definition: loop.cc:42