5#include "flutter/fml/platform/darwin/message_loop_darwin.h"
7#include <CoreFoundation/CFRunLoop.h>
8#include <Foundation/Foundation.h>
10#include "flutter/fml/logging.h"
18MessageLoopDarwin::MessageLoopDarwin()
19 : running_(
false), loop_((CFRunLoopRef)CFRetain(CFRunLoopGetCurrent())) {
23 CFRunLoopTimerContext timer_context = {
26 delayed_wake_timer_.Reset(
29 reinterpret_cast<CFRunLoopTimerCallBack
>(&MessageLoopDarwin::OnTimerFire)
33 CFRunLoopAddTimer(loop_, delayed_wake_timer_, kCFRunLoopCommonModes);
35 CFRunLoopAddTimer(loop_, delayed_wake_timer_, kMessageLoopCFRunLoopMode);
38MessageLoopDarwin::~MessageLoopDarwin() {
39 CFRunLoopTimerInvalidate(delayed_wake_timer_);
40 CFRunLoopRemoveTimer(loop_, delayed_wake_timer_, kCFRunLoopCommonModes);
41 CFRunLoopRemoveTimer(loop_, delayed_wake_timer_, kMessageLoopCFRunLoopMode);
52 if (
result == kCFRunLoopRunStopped ||
result == kCFRunLoopRunFinished) {
64void MessageLoopDarwin::Terminate() {
69 CFRef<CFRunLoopRef> local_loop(loop_);
71 CFRunLoopStop(local_loop);
77 CFRunLoopTimerSetNextFireDate(
82void MessageLoopDarwin::OnTimerFire(CFRunLoopTimerRef timer, MessageLoopDarwin* loop) {
85 loop->RunExpiredTasksNow();
static CFStringRef kMessageLoopCFRunLoopMode
#define FML_DCHECK(condition)
static FLUTTER_ASSERT_ARC constexpr CFTimeInterval kDistantFuture
static constexpr CFTimeInterval kDistantFuture