[iOS] Don’t perform a per frame platform to UI thread switch. (flutter/engine#3288)

This commit is contained in:
Chinmay Garde
2016-12-01 17:35:40 -08:00
committed by GitHub
parent 1ac8083795
commit 357892b8ef

View File

@@ -32,8 +32,12 @@
displayLinkWithTarget:self
selector:@selector(onDisplayLink:)] retain];
_displayLink.paused = YES;
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
blink::Threads::UI()->PostTask([client = [self retain]]() {
[client->_displayLink addToRunLoop:[NSRunLoop currentRunLoop]
forMode:NSRunLoopCommonModes];
[client release];
});
}
return self;
@@ -52,8 +56,7 @@
_displayLink.paused = YES;
auto callback = std::move(_pendingCallback);
_pendingCallback = shell::VsyncWaiter::Callback();
blink::Threads::UI()->PostTask(
[callback, frame_time] { callback(frame_time); });
callback(frame_time);
}
- (void)dealloc {