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_LINUX_MESSAGE_LOOP_LINUX_H_ 6 #define FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_ 7 8 #include <atomic> 9 10 #include "flutter/fml/macros.h" 11 #include "flutter/fml/message_loop_impl.h" 12 #include "flutter/fml/unique_fd.h" 13 14 namespace fml { 15 16 class MessageLoopLinux : public MessageLoopImpl { 17 private: 18 fml::UniqueFD epoll_fd_; 19 fml::UniqueFD timer_fd_; 20 bool running_; 21 22 MessageLoopLinux(); 23 24 ~MessageLoopLinux() override; 25 26 // |fml::MessageLoopImpl| 27 void Run() override; 28 29 // |fml::MessageLoopImpl| 30 void Terminate() override; 31 32 // |fml::MessageLoopImpl| 33 void WakeUp(fml::TimePoint time_point) override; 34 35 void OnEventFired(); 36 37 bool AddOrRemoveTimerSource(bool add); 38 39 FML_FRIEND_MAKE_REF_COUNTED(MessageLoopLinux); 40 FML_FRIEND_REF_COUNTED_THREAD_SAFE(MessageLoopLinux); 41 FML_DISALLOW_COPY_AND_ASSIGN(MessageLoopLinux); 42 }; 43 44 } // namespace fml 45 46 #endif // FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_ 47