message_loop_linux.h 1016 字节
Newer Older
C
Chinmay Garde 已提交
1 2 3 4 5 6 7 8 9 10
// Copyright 2017 The Chromium Authors. All rights reserved.
// 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>

#include "flutter/fml/message_loop_impl.h"
11
#include "flutter/fml/unique_fd.h"
12
#include "lib/fxl/macros.h"
C
Chinmay Garde 已提交
13 14 15 16 17

namespace fml {

class MessageLoopLinux : public MessageLoopImpl {
 private:
18 19
  fml::UniqueFD epoll_fd_;
  fml::UniqueFD timer_fd_;
C
Chinmay Garde 已提交
20 21 22 23 24 25 26 27 28 29
  bool running_;

  MessageLoopLinux();

  ~MessageLoopLinux() override;

  void Run() override;

  void Terminate() override;

30
  void WakeUp(fxl::TimePoint time_point) override;
C
Chinmay Garde 已提交
31 32 33 34 35 36 37

  void OnEventFired();

  bool AddOrRemoveTimerSource(bool add);

  FRIEND_MAKE_REF_COUNTED(MessageLoopLinux);
  FRIEND_REF_COUNTED_THREAD_SAFE(MessageLoopLinux);
38
  FXL_DISALLOW_COPY_AND_ASSIGN(MessageLoopLinux);
C
Chinmay Garde 已提交
39 40 41 42 43
};

}  // namespace fml

#endif  // FLUTTER_FML_PLATFORM_LINUX_MESSAGE_LOOP_LINUX_H_