Start the runloop asynchronously rather than synchronously during activation#1142
Conversation
…ead. This turned out to be bad for some apps. This change is to do an aysnc task that sets up the runloop.
|
@jaredhms is added to the review. #Closed |
| [displayMode _updateDisplaySettings]; | ||
|
|
||
| UIApplicationMainInit(principalClassName, delegateClassName, defaultOrientation, (int)activationType, activationArgument); | ||
| ScheduleMainRunLoop(); |
There was a problem hiding this comment.
ScheduleMainRunLoop [](start = 4, length = 19)
This was taking > 20s for internal test app. With async, we take that cost after app activation so PLM doesn't kill us.
|
|
||
| /** | ||
| * Private method to create the dispatcher | ||
| */ |
There was a problem hiding this comment.
_ensureDispatcher [](start = 5, length = 17)
nit: should be _PascalCase #Pending
|
|
|
|
|
|
||
| /** | ||
| * Private method to create the dispatcher | ||
| */ |
There was a problem hiding this comment.
super-nit: should this be static? #Pending
| auto dispatchCallback = WRLHelpers::MakeAgileCallback<IDispatchedHandler>([]() -> HRESULT { | ||
| ScheduleMainRunLoop(); | ||
| return S_OK; | ||
| }); |
There was a problem hiding this comment.
I think one e was missed here! #Pending
| /** | ||
| * Private method to create the dispatcher | ||
| */ | ||
| void _EnsureDispatcher() { |
There was a problem hiding this comment.
Can we be sure this is thread-safe? #Pending
There was a problem hiding this comment.
Good point. This is always initialized in the main thread, so the _EnsureDispatcher in the other thread is unnecessary, I'll remove that.
In reply to: 83293021 [](ancestors = 83293021)
…ivation (microsoft#1142) * Our activation code is starting runloop synchornously in the main thread. This turned out to be bad for some apps. This change is to do an aysnc task that sets up the runloop. * Added comments on why runloop has to be done asynchronously * Code review feedback * Code review feedback * Code review comments
Our activation code is starting runloop synchornously in the main thread.
This turned out to be bad for some apps. This change is to do an aysnc task that sets up the runloop.