Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Attributes | Private Member Functions | List of all members
fml::MessageLoopDarwin Class Reference

#include <message_loop_darwin.h>

Inheritance diagram for fml::MessageLoopDarwin:
fml::MessageLoopImpl fml::Wakeable fml::RefCountedThreadSafe< MessageLoopImpl > fml::internal::RefCountedThreadSafeBase

Static Public Attributes

static CFStringRef kMessageLoopCFRunLoopMode = CFSTR("fmlMessageLoop")
 

Private Member Functions

 ~MessageLoopDarwin () override
 
void Run () override
 
void Terminate () override
 
void WakeUp (fml::TimePoint time_point) override
 

Additional Inherited Members

- Public Member Functions inherited from fml::MessageLoopImpl
virtual ~MessageLoopImpl ()
 
void PostTask (const fml::closure &task, fml::TimePoint target_time)
 
void AddTaskObserver (intptr_t key, const fml::closure &callback)
 
void RemoveTaskObserver (intptr_t key)
 
void DoRun ()
 
void DoTerminate ()
 
virtual TaskQueueId GetTaskQueueId () const
 
- Public Member Functions inherited from fml::Wakeable
virtual ~Wakeable ()
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< MessageLoopImpl >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Static Public Member Functions inherited from fml::MessageLoopImpl
static fml::RefPtr< MessageLoopImplCreate ()
 
- Protected Member Functions inherited from fml::MessageLoopImpl
void RunExpiredTasksNow ()
 
void RunSingleExpiredTaskNow ()
 
 MessageLoopImpl ()
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< MessageLoopImpl >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

Definition at line 18 of file message_loop_darwin.h.

Member Function Documentation

◆ Run()

void fml::MessageLoopDarwin::Run ( )
overrideprivatevirtual

Implements fml::MessageLoopImpl.

Definition at line 44 of file message_loop_darwin.mm.

44 {
45 FML_DCHECK(loop_ == CFRunLoopGetCurrent());
46
47 running_ = true;
48
49 while (running_) {
50 @autoreleasepool {
51 int result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, kDistantFuture, YES);
52 if (result == kCFRunLoopRunStopped || result == kCFRunLoopRunFinished) {
53 // This handles the case where the loop is terminated using
54 // CoreFoundation APIs.
55 @autoreleasepool {
57 }
58 running_ = false;
59 }
60 }
61 }
62}
GAsyncResult * result
#define FML_DCHECK(condition)
Definition logging.h:103
static constexpr CFTimeInterval kDistantFuture

◆ Terminate()

void fml::MessageLoopDarwin::Terminate ( )
overrideprivatevirtual

Implements fml::MessageLoopImpl.

Definition at line 64 of file message_loop_darwin.mm.

64 {
65 running_ = false;
66
67 // Ensure that the CFRunLoop remains alive through the end of this function
68 // even if the loop's thread exits and drops its reference to the loop.
69 CFRef<CFRunLoopRef> local_loop(loop_);
70
71 CFRunLoopStop(local_loop);
72}

◆ WakeUp()

void fml::MessageLoopDarwin::WakeUp ( fml::TimePoint  time_point)
overrideprivatevirtual

Implements fml::Wakeable.

Definition at line 74 of file message_loop_darwin.mm.

74 {
75 // Rearm the timer. The time bases used by CoreFoundation and FXL are
76 // different and must be accounted for.
77 CFRunLoopTimerSetNextFireDate(
78 delayed_wake_timer_,
79 CFAbsoluteTimeGetCurrent() + (time_point - fml::TimePoint::Now()).ToSecondsF());
80}
static TimePoint Now()
Definition time_point.cc:49

◆ ~MessageLoopDarwin()

fml::MessageLoopDarwin::~MessageLoopDarwin ( )
overrideprivate

Definition at line 38 of file message_loop_darwin.mm.

38 {
39 CFRunLoopTimerInvalidate(delayed_wake_timer_);
40 CFRunLoopRemoveTimer(loop_, delayed_wake_timer_, kCFRunLoopCommonModes);
41 CFRunLoopRemoveTimer(loop_, delayed_wake_timer_, kMessageLoopCFRunLoopMode);
42}
static CFStringRef kMessageLoopCFRunLoopMode

Member Data Documentation

◆ kMessageLoopCFRunLoopMode

CFStringRef fml::MessageLoopDarwin::kMessageLoopCFRunLoopMode = CFSTR("fmlMessageLoop")
static

Definition at line 23 of file message_loop_darwin.h.


The documentation for this class was generated from the following files: