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:
@@ -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
|
void
|
||||||
ServerWindow::SetTitle(const char* newTitle)
|
ServerWindow::SetTitle(const char* newTitle)
|
||||||
{
|
{
|
||||||
@@ -862,9 +874,8 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case AS_REDRAW:
|
case AS_REDRAW:
|
||||||
// command issued by Desktop only (via WindowLayer::ProcessDirtyRegion())
|
// Nothing to do here - the redraws are actually handled by looking
|
||||||
DTRACE(("ServerWindow %s: AS_REDRAW\n", Title()));
|
// at the fRedrawRequested member variable in _MessageLooper().
|
||||||
fWindowLayer->RedrawDirtyRegion();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AS_BEGIN_UPDATE:
|
case AS_BEGIN_UPDATE:
|
||||||
@@ -2169,6 +2180,10 @@ ServerWindow::_MessageLooper()
|
|||||||
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 {
|
} else {
|
||||||
fDesktop->LockSingleWindow();
|
fDesktop->LockSingleWindow();
|
||||||
|
|
||||||
|
if (atomic_and(&fRedrawRequested, 0) != 0)
|
||||||
|
fWindowLayer->RedrawDirtyRegion();
|
||||||
|
|
||||||
_DispatchMessage(code, receiver);
|
_DispatchMessage(code, receiver);
|
||||||
fDesktop->UnlockSingleWindow();
|
fDesktop->UnlockSingleWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public:
|
|||||||
inline int32 ClientToken() const { return fClientToken; }
|
inline int32 ClientToken() const { return fClientToken; }
|
||||||
inline int32 ServerToken() const { return fServerToken; }
|
inline int32 ServerToken() const { return fServerToken; }
|
||||||
|
|
||||||
|
void RequestRedraw();
|
||||||
|
|
||||||
void GetInfo(window_info& info);
|
void GetInfo(window_info& info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -150,6 +152,7 @@ private:
|
|||||||
::EventTarget fEventTarget;
|
::EventTarget fEventTarget;
|
||||||
|
|
||||||
BMessage fClientViewsWithInvalidCoords;
|
BMessage fClientViewsWithInvalidCoords;
|
||||||
|
int32 fRedrawRequested;
|
||||||
|
|
||||||
int32 fServerToken;
|
int32 fServerToken;
|
||||||
int32 fClientToken;
|
int32 fClientToken;
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ WindowLayer::ProcessDirtyRegion(BRegion& region)
|
|||||||
// Until the message is processed in the window
|
// Until the message is processed in the window
|
||||||
// thread, the desktop thread can add parts to
|
// thread, the desktop thread can add parts to
|
||||||
// the region as it likes.
|
// the region as it likes.
|
||||||
ServerWindow()->PostMessage(AS_REDRAW);
|
ServerWindow()->RequestRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is executed from the desktop thread
|
// this is executed from the desktop thread
|
||||||
|
|||||||
Reference in New Issue
Block a user