WindowLayer::ProcessDirtyRegions() no longer deadlock in case it can't send

the AS_REDRAW message.
The AS_REDRAW message is now only used as a notifier - it's arrival is not
critical anymore, IOW it's simply dropped when the queue is full.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15511 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-12 13:14:21 +00:00
parent b02ce81171
commit 58290b7b37
3 changed files with 22 additions and 4 deletions

View File

@ -350,6 +350,18 @@ fDesktop->LockSingleWindow();
}
void
ServerWindow::RequestRedraw()
{
PostMessage(AS_REDRAW, 0);
// we don't care if this fails - it's only a notification, and if
// it fails, there are obviously enough messages in the queue
// already
atomic_add(&fRedrawRequested, 1);
}
void
ServerWindow::SetTitle(const char* newTitle)
{
@ -862,9 +874,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
}
case AS_REDRAW:
// command issued by Desktop only (via WindowLayer::ProcessDirtyRegion())
DTRACE(("ServerWindow %s: AS_REDRAW\n", Title()));
fWindowLayer->RedrawDirtyRegion();
// Nothing to do here - the redraws are actually handled by looking
// at the fRedrawRequested member variable in _MessageLooper().
break;
case AS_BEGIN_UPDATE:
@ -2169,6 +2180,10 @@ ServerWindow::_MessageLooper()
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
} else {
fDesktop->LockSingleWindow();
if (atomic_and(&fRedrawRequested, 0) != 0)
fWindowLayer->RedrawDirtyRegion();
_DispatchMessage(code, receiver);
fDesktop->UnlockSingleWindow();
}

View File

@ -102,6 +102,8 @@ public:
inline int32 ClientToken() const { return fClientToken; }
inline int32 ServerToken() const { return fServerToken; }
void RequestRedraw();
void GetInfo(window_info& info);
private:
@ -150,6 +152,7 @@ private:
::EventTarget fEventTarget;
BMessage fClientViewsWithInvalidCoords;
int32 fRedrawRequested;
int32 fServerToken;
int32 fClientToken;

View File

@ -624,7 +624,7 @@ WindowLayer::ProcessDirtyRegion(BRegion& region)
// Until the message is processed in the window
// thread, the desktop thread can add parts to
// the region as it likes.
ServerWindow()->PostMessage(AS_REDRAW);
ServerWindow()->RequestRedraw();
}
// this is executed from the desktop thread