2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2017-03-20 14:49:10 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#ifndef FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_
|
|
|
|
|
#define FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
|
2018-04-21 20:50:03 -07:00
|
|
|
#include "flutter/fml/macros.h"
|
2017-03-20 14:49:10 -07:00
|
|
|
#include "flutter/fml/message_loop_impl.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
#include "flutter/fml/unique_fd.h"
|
2017-03-20 14:49:10 -07:00
|
|
|
|
|
|
|
|
namespace fml {
|
|
|
|
|
|
|
|
|
|
class MessageLoopLinux : public MessageLoopImpl {
|
|
|
|
|
private:
|
2018-04-13 13:48:15 -07:00
|
|
|
fml::UniqueFD epoll_fd_;
|
|
|
|
|
fml::UniqueFD timer_fd_;
|
2017-03-20 14:49:10 -07:00
|
|
|
bool running_;
|
|
|
|
|
|
|
|
|
|
MessageLoopLinux();
|
|
|
|
|
|
|
|
|
|
~MessageLoopLinux() override;
|
|
|
|
|
|
2019-04-09 17:03:41 -07:00
|
|
|
// |fml::MessageLoopImpl|
|
2017-03-20 14:49:10 -07:00
|
|
|
void Run() override;
|
|
|
|
|
|
2019-04-09 17:03:41 -07:00
|
|
|
// |fml::MessageLoopImpl|
|
2017-03-20 14:49:10 -07:00
|
|
|
void Terminate() override;
|
|
|
|
|
|
2019-04-09 17:03:41 -07:00
|
|
|
// |fml::MessageLoopImpl|
|
2018-07-26 12:49:34 -07:00
|
|
|
void WakeUp(fml::TimePoint time_point) override;
|
2017-03-20 14:49:10 -07:00
|
|
|
|
|
|
|
|
void OnEventFired();
|
|
|
|
|
|
|
|
|
|
bool AddOrRemoveTimerSource(bool add);
|
|
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_FRIEND_MAKE_REF_COUNTED(MessageLoopLinux);
|
|
|
|
|
FML_FRIEND_REF_COUNTED_THREAD_SAFE(MessageLoopLinux);
|
2018-04-21 20:50:03 -07:00
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(MessageLoopLinux);
|
2017-03-20 14:49:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace fml
|
|
|
|
|
|
|
|
|
|
#endif // FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_
|