Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
message_loop_darwin.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_DARWIN_MESSAGE_LOOP_DARWIN_H_
6#define FLUTTER_FML_PLATFORM_DARWIN_MESSAGE_LOOP_DARWIN_H_
7
8#include <CoreFoundation/CoreFoundation.h>
9
10#include <atomic>
11
12#include "flutter/fml/macros.h"
13#include "flutter/fml/message_loop_impl.h"
14#include "flutter/fml/platform/darwin/cf_utils.h"
15
16namespace fml {
17
19 public:
20 // A custom CFRunLoop mode used when processing flutter messages,
21 // so that the CFRunLoop can be run without being interrupted by UIKit,
22 // while still being able to receive and be interrupted by framework messages.
23 static CFStringRef kMessageLoopCFRunLoopMode;
24
25 private:
26 std::atomic_bool running_;
27 CFRef<CFRunLoopTimerRef> delayed_wake_timer_;
29
31
32 ~MessageLoopDarwin() override;
33
34 // |fml::MessageLoopImpl|
35 void Run() override;
36
37 // |fml::MessageLoopImpl|
38 void Terminate() override;
39
40 // |fml::MessageLoopImpl|
41 void WakeUp(fml::TimePoint time_point) override;
42
43 static void OnTimerFire(CFRunLoopTimerRef timer, MessageLoopDarwin* loop);
44
45 FML_FRIEND_MAKE_REF_COUNTED(MessageLoopDarwin);
46 FML_FRIEND_REF_COUNTED_THREAD_SAFE(MessageLoopDarwin);
47 FML_DISALLOW_COPY_AND_ASSIGN(MessageLoopDarwin);
48};
49
50} // namespace fml
51
52#endif // FLUTTER_FML_PLATFORM_DARWIN_MESSAGE_LOOP_DARWIN_H_
static CFStringRef kMessageLoopCFRunLoopMode
Definition: ascii_trie.cc:9