Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Start the runloop asynchronously rather than synchronously during activation#1142

Merged
rajsesh merged 6 commits into
microsoft:developfrom
rajsesh:quick_activate
Oct 13, 2016
Merged

Start the runloop asynchronously rather than synchronously during activation#1142
rajsesh merged 6 commits into
microsoft:developfrom
rajsesh:quick_activate

Conversation

@rajsesh

@rajsesh rajsesh commented Oct 13, 2016

Copy link
Copy Markdown
Contributor

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.

…ead.

This turned out to be bad for some apps.  This change is to do an aysnc
task that sets up the runloop.
@rajsesh

rajsesh commented Oct 13, 2016

Copy link
Copy Markdown
Contributor Author

@jaredhms is added to the review. #Closed

[displayMode _updateDisplaySettings];

UIApplicationMainInit(principalClassName, delegateClassName, defaultOrientation, (int)activationType, activationArgument);
ScheduleMainRunLoop();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
*/

@jaredhms jaredhms Oct 13, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ensureDispatcher [](start = 5, length = 17)

nit: should be _PascalCase #Pending

@jaredhms

Copy link
Copy Markdown
Contributor

:shipit:

@msft-Jeyaram

Copy link
Copy Markdown

:shipit:


/**
* Private method to create the dispatcher
*/

@DHowett-MSFT DHowett-MSFT Oct 13, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-nit: should this be static? #Pending

auto dispatchCallback = WRLHelpers::MakeAgileCallback<IDispatchedHandler>([]() -> HRESULT {
ScheduleMainRunLoop();
return S_OK;
});

@DHowett-MSFT DHowett-MSFT Oct 13, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one e was missed here! #Pending

/**
* Private method to create the dispatcher
*/
void _EnsureDispatcher() {

@DHowett-MSFT DHowett-MSFT Oct 13, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be sure this is thread-safe? #Pending

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@rajsesh rajsesh merged commit a1f06ac into microsoft:develop Oct 13, 2016
@rajsesh rajsesh deleted the quick_activate branch October 13, 2016 21:46
aballway pushed a commit to aballway/WinObjC that referenced this pull request Oct 19, 2016
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants