The ServerWindow now keeps the desktop (read) lock for up to 70 messages at once.
This should make drawing a bit smoother. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15515 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2168,25 +2168,37 @@ ServerWindow::_MessageLooper()
|
|||||||
printf("ServerWindow %s: lock acquisition took %Ld usecs\n", Title(), diff);
|
printf("ServerWindow %s: lock acquisition took %Ld usecs\n", Title(), diff);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int32 messagesProcessed = 0;
|
||||||
|
bool lockedDesktop = false;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
if (code == AS_DELETE_WINDOW || code == kMsgQuitLooper) {
|
if (code == AS_DELETE_WINDOW || code == kMsgQuitLooper) {
|
||||||
// this means the client has been killed
|
// this means the client has been killed
|
||||||
STRACE(("ServerWindow %s received 'AS_DELETE_WINDOW' message code\n",
|
STRACE(("ServerWindow %s received 'AS_DELETE_WINDOW' message code\n",
|
||||||
Title()));
|
Title()));
|
||||||
|
|
||||||
|
if (lockedDesktop)
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
quitLoop = true;
|
quitLoop = true;
|
||||||
|
|
||||||
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
||||||
if (!fWindowLayer->IsHidden())
|
if (!fWindowLayer->IsHidden())
|
||||||
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
|
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
|
||||||
} else {
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lockedDesktop) {
|
||||||
|
// only lock it once
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
|
lockedDesktop = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (atomic_and(&fRedrawRequested, 0) != 0)
|
if (atomic_and(&fRedrawRequested, 0) != 0)
|
||||||
fWindowLayer->RedrawDirtyRegion();
|
fWindowLayer->RedrawDirtyRegion();
|
||||||
|
|
||||||
_DispatchMessage(code, receiver);
|
_DispatchMessage(code, receiver);
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PROFILE_MESSAGE_LOOP
|
#ifdef PROFILE_MESSAGE_LOOP
|
||||||
if (code >= 0 && code < AS_LAST_CODE) {
|
if (code >= 0 && code < AS_LAST_CODE) {
|
||||||
@@ -2202,6 +2214,24 @@ ServerWindow::_MessageLooper()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// only process up to 70 waiting messages at once (we have the Desktop locked)
|
||||||
|
if (!receiver.HasMessages() || ++messagesProcessed > 70) {
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
status_t status = receiver.GetNextMessage(code);
|
||||||
|
if (status < B_OK) {
|
||||||
|
// that shouldn't happen, it's our port
|
||||||
|
printf("Someone deleted our message port!\n");
|
||||||
|
fDesktop->UnlockSingleWindow();
|
||||||
|
|
||||||
|
// try to let our client die happily
|
||||||
|
NotifyQuitRequested();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user