-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RAPPS] Load icons on background thread #6881
base: master
Are you sure you want to change the base?
Conversation
- Load icons on background thread to massively reduce loading time. - Use SM_CXICON sized icons consistently instead of hardcoding 32 in some places.
base/applications/rapps/appview.cpp
Outdated
ItemCount = 0; | ||
CheckedItemCount = 0; | ||
|
||
ListView_Scroll(m_hWnd, 0, 0x7fff * -1); // Fixes a bug in Wine ComCtl32 where VScroll is not reset after deleting items |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a ticket for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I know of.
} | ||
|
||
VOID | ||
CMainWindow::UpdateApplicationsList(AppsCategories EnumType, BOOL bReload, BOOL bCheckAvailable) | ||
{ | ||
bUpdating = TRUE; | ||
|
||
if (HCURSOR hCursor = LoadCursor(NULL, IDC_APPSTARTING)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference with IDC_WAIT
?
Wouldn't https://git.reactos.org/?p=reactos.git;a=blob;f=sdk/include/reactos/ui/CWaitCursor.h;h=38bc74d614d59934030539d718e1bb7cd720d0bd;hb=HEAD
be of any use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDC_WAIT is the big hourglass and IDC_APPSTARTING is the arrow with small hourglass and is less jarring when the wait is somewhat short.
if (!AppInfo.RetrieveIcon(szIconPath)) | ||
return NULL; | ||
SIZE_T cch = szIconPath.GetLength() + 1, cbstr = cch * sizeof(WCHAR); | ||
CAsyncLoadIcon *task = (CAsyncLoadIcon*)LocalAlloc(LMEM_FIXED, sizeof(CAsyncLoadIcon) + cbstr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not using new
operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it would not let me use try/catch because of project settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose I could use new std::nothrow.
static DWORD CALLBACK | ||
AsyncLoadIconProc(LPVOID Param) | ||
{ | ||
for (CAsyncLoadIcon *task = (CAsyncLoadIcon*)Param, *old; task; old->Free()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this "old" variable ? Where is it defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean, it's defined right there (and initialized and the end of the loop). It is walking the linked list and exists because you can't access the next pointer after freeing.
CopyMemory(task->Location, szIconPath.GetBuffer(), cbstr); | ||
szIconPath.ReleaseBuffer(); | ||
task->pNext = g_AsyncIconTasks; | ||
g_AsyncIconTasks = task; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this CAsyncLoadIcon::Queue()
helper be called concurrently?
If so, this g_AsyncIconTasks
should probably be InterlockedExchangePointer
'ed...
Or maybe, use a SLIST or something where queuing can be done atomically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot, all of this is happening on the UI thread. And the assert is there to make sure it stays that way.
Load icons on a background thread to massively reduce loading time.
Use SM_CXICON sized icons consistently instead of hard-coding 32 in some places.