From b0220a3af30954cac1a744d3029199e1d0a6f330 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 1 Dec 2016 17:35:40 -0800 Subject: [PATCH] =?UTF-8?q?[iOS]=20Don=E2=80=99t=20perform=20a=20per=20fra?= =?UTF-8?q?me=20platform=20to=20UI=20thread=20switch.=20(#3288)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../darwin/ios/framework/Source/vsync_waiter_ios.mm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm index 6e0a36033..5cb01970d 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm @@ -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 { -- GitLab