Flutter Engine
message_loop_android.h
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 #ifndef FLUTTER_FML_PLATFORM_ANDROID_MESSAGE_LOOP_ANDROID_H_
6 #define FLUTTER_FML_PLATFORM_ANDROID_MESSAGE_LOOP_ANDROID_H_
7 
8 #include <android/looper.h>
9 
10 #include <atomic>
11 
12 #include "flutter/fml/macros.h"
13 #include "flutter/fml/message_loop_impl.h"
14 #include "flutter/fml/unique_fd.h"
15 
16 namespace fml {
17 
19  static ALooper* InvalidValue() { return nullptr; }
20  static bool IsValid(ALooper* value) { return value != nullptr; }
21  static void Free(ALooper* value) { ::ALooper_release(value); }
22 };
23 
24 /// Android implementation of \p MessageLoopImpl.
25 ///
26 /// This implemenation wraps usage of Android's \p looper.
27 /// \see https://developer.android.com/ndk/reference/group/looper
29  private:
31  fml::UniqueFD timer_fd_;
32  bool running_;
33 
35 
36  ~MessageLoopAndroid() override;
37 
38  void Run() override;
39 
40  void Terminate() override;
41 
42  void WakeUp(fml::TimePoint time_point) override;
43 
44  void OnEventFired();
45 
49 };
50 
51 } // namespace fml
52 
53 #endif // FLUTTER_FML_PLATFORM_ANDROID_MESSAGE_LOOP_ANDROID_H_
static bool IsValid(ALooper *value)
#define FML_FRIEND_REF_COUNTED_THREAD_SAFE(T)
Definition: ref_counted.h:126
Definition: ascii_trie.cc:9
static void Free(ALooper *value)
#define FML_FRIEND_MAKE_REF_COUNTED(T)
Definition: ref_counted.h:132
uint8_t value
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
static ALooper * InvalidValue()