This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-27
lines changed
shell/platform/darwin/macos/framework/Source Expand file tree Collapse file tree 1 file changed +3
-27
lines changed Original file line number Diff line number Diff line change 1
1
#import " flutter/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizer.h"
2
+ #import " fml/synchronization/waitable_event.h"
2
3
3
4
#import < QuartzCore/QuartzCore.h>
4
5
#include < mutex>
@@ -17,31 +18,6 @@ @interface FlutterThreadSynchronizer () {
17
18
18
19
@end
19
20
20
- namespace {
21
- // / Single use event (can only be signalled once).
22
- class Event {
23
- public:
24
- void Signal () {
25
- assert (!signaled_);
26
- std::scoped_lock locker (mutex_);
27
- signaled_ = true ;
28
- cv_.notify_one ();
29
- }
30
-
31
- void Wait () {
32
- std::unique_lock<std::mutex> locker (mutex_);
33
- while (!signaled_) {
34
- cv_.wait (locker);
35
- }
36
- }
37
-
38
- private:
39
- std::condition_variable cv_;
40
- std::mutex mutex_;
41
- bool signaled_ = false ;
42
- };
43
- } // namespace
44
-
45
21
@implementation FlutterThreadSynchronizer
46
22
47
23
- (void )drain {
@@ -101,10 +77,10 @@ - (void)beginResize:(CGSize)size notify:(nonnull dispatch_block_t)notify {
101
77
}
102
78
103
79
- (void )performCommit : (CGSize)size notify : (nonnull dispatch_block_t )notify {
104
- Event event;
80
+ fml::AutoResetWaitableEvent event;
105
81
{
106
82
std::unique_lock<std::mutex> lock (_mutex);
107
- Event & e = event;
83
+ fml::AutoResetWaitableEvent & e = event;
108
84
_scheduledBlocks.push_back (^{
109
85
notify ();
110
86
_contentSize = size;
You can’t perform that action at this time.
0 commit comments