Cache a view's server token. Avoids getting it for every
BView method that contacts the server. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31134 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -317,7 +317,7 @@ public:
|
|||||||
const BGradient& gradient);
|
const BGradient& gradient);
|
||||||
void FillPolygon(const BPoint* ptArray, int32 numPts,
|
void FillPolygon(const BPoint* ptArray, int32 numPts,
|
||||||
BRect bounds, const BGradient& gradient);
|
BRect bounds, const BGradient& gradient);
|
||||||
|
|
||||||
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
||||||
BRect bounds, pattern p = B_SOLID_HIGH);
|
BRect bounds, pattern p = B_SOLID_HIGH);
|
||||||
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3,
|
||||||
@@ -356,7 +356,7 @@ public:
|
|||||||
void FillEllipse(BPoint center, float xRadius,
|
void FillEllipse(BPoint center, float xRadius,
|
||||||
float yRadius, const BGradient& gradient);
|
float yRadius, const BGradient& gradient);
|
||||||
void FillEllipse(BRect r, const BGradient& gradient);
|
void FillEllipse(BRect r, const BGradient& gradient);
|
||||||
|
|
||||||
void StrokeArc(BPoint center, float xRadius,
|
void StrokeArc(BPoint center, float xRadius,
|
||||||
float yRadius, float startAngle, float arcAngle,
|
float yRadius, float startAngle, float arcAngle,
|
||||||
pattern p = B_SOLID_HIGH);
|
pattern p = B_SOLID_HIGH);
|
||||||
@@ -372,14 +372,14 @@ public:
|
|||||||
const BGradient& gradient);
|
const BGradient& gradient);
|
||||||
void FillArc(BRect r, float startAngle, float arcAngle,
|
void FillArc(BRect r, float startAngle, float arcAngle,
|
||||||
const BGradient& gradient);
|
const BGradient& gradient);
|
||||||
|
|
||||||
void StrokeBezier(BPoint* controlPoints,
|
void StrokeBezier(BPoint* controlPoints,
|
||||||
pattern p = B_SOLID_HIGH);
|
pattern p = B_SOLID_HIGH);
|
||||||
void FillBezier(BPoint* controlPoints,
|
void FillBezier(BPoint* controlPoints,
|
||||||
pattern p = B_SOLID_HIGH);
|
pattern p = B_SOLID_HIGH);
|
||||||
void FillBezier(BPoint* controlPoints,
|
void FillBezier(BPoint* controlPoints,
|
||||||
const BGradient& gradient);
|
const BGradient& gradient);
|
||||||
|
|
||||||
void StrokeShape(BShape* shape,
|
void StrokeShape(BShape* shape,
|
||||||
pattern p = B_SOLID_HIGH);
|
pattern p = B_SOLID_HIGH);
|
||||||
void FillShape(BShape* shape, pattern p = B_SOLID_HIGH);
|
void FillShape(BShape* shape, pattern p = B_SOLID_HIGH);
|
||||||
@@ -622,7 +622,7 @@ private:
|
|||||||
void _PrintToStream();
|
void _PrintToStream();
|
||||||
void _PrintTree();
|
void _PrintTree();
|
||||||
|
|
||||||
int32 server_token;
|
int32 fServerToken;
|
||||||
uint32 fFlags;
|
uint32 fFlags;
|
||||||
BPoint fParentOffset;
|
BPoint fParentOffset;
|
||||||
BWindow* fOwner;
|
BWindow* fOwner;
|
||||||
|
|||||||
+11
-17
@@ -1000,7 +1000,7 @@ BView::SetViewCursor(const BCursor *cursor, bool sync)
|
|||||||
|
|
||||||
ViewSetViewCursorInfo info;
|
ViewSetViewCursorInfo info;
|
||||||
info.cursorToken = cursor->fServerToken;
|
info.cursorToken = cursor->fServerToken;
|
||||||
info.viewToken = _get_object_token_(this); // TODO: Use server_token!
|
info.viewToken = fServerToken;
|
||||||
info.sync = sync;
|
info.sync = sync;
|
||||||
|
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
@@ -3906,8 +3906,7 @@ BView::_RemoveSelf()
|
|||||||
if (owner != NULL && !fTopLevelView) {
|
if (owner != NULL && !fTopLevelView) {
|
||||||
// the top level view is deleted by the app_server automatically
|
// the top level view is deleted by the app_server automatically
|
||||||
owner->fLink->StartMessage(AS_VIEW_DELETE);
|
owner->fLink->StartMessage(AS_VIEW_DELETE);
|
||||||
// TODO: Use server_token
|
owner->fLink->Attach<int32>(fServerToken);
|
||||||
owner->fLink->Attach<int32>(_get_object_token_(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->InvalidateLayout();
|
parent->InvalidateLayout();
|
||||||
@@ -4646,6 +4645,7 @@ BView::_InitData(BRect frame, const char *name, uint32 resizingMode,
|
|||||||
|
|
||||||
fParentOffset.Set(frame.left, frame.top);
|
fParentOffset.Set(frame.left, frame.top);
|
||||||
|
|
||||||
|
fServerToken = _get_object_token_(this);
|
||||||
fOwner = NULL;
|
fOwner = NULL;
|
||||||
fParent = NULL;
|
fParent = NULL;
|
||||||
fNextSibling = NULL;
|
fNextSibling = NULL;
|
||||||
@@ -4902,8 +4902,7 @@ BView::_CreateSelf()
|
|||||||
else
|
else
|
||||||
fOwner->fLink->StartMessage(AS_VIEW_CREATE);
|
fOwner->fLink->StartMessage(AS_VIEW_CREATE);
|
||||||
|
|
||||||
// TODO: Use server_token
|
fOwner->fLink->Attach<int32>(fServerToken);
|
||||||
fOwner->fLink->Attach<int32>(_get_object_token_(this));
|
|
||||||
fOwner->fLink->AttachString(Name());
|
fOwner->fLink->AttachString(Name());
|
||||||
fOwner->fLink->Attach<BRect>(Frame());
|
fOwner->fLink->Attach<BRect>(Frame());
|
||||||
fOwner->fLink->Attach<BPoint>(LeftTop());
|
fOwner->fLink->Attach<BPoint>(LeftTop());
|
||||||
@@ -4916,8 +4915,7 @@ BView::_CreateSelf()
|
|||||||
if (fTopLevelView)
|
if (fTopLevelView)
|
||||||
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
fOwner->fLink->Attach<int32>(B_NULL_TOKEN);
|
||||||
else
|
else
|
||||||
// TODO: Use server_token
|
fOwner->fLink->Attach<int32>(fParent->fServerToken);
|
||||||
fOwner->fLink->Attach<int32>(_get_object_token_(fParent));
|
|
||||||
fOwner->fLink->Flush();
|
fOwner->fLink->Flush();
|
||||||
|
|
||||||
_CheckOwnerLockAndSwitchCurrent();
|
_CheckOwnerLockAndSwitchCurrent();
|
||||||
@@ -5125,8 +5123,7 @@ BView::_Detach()
|
|||||||
if (fOwner->fLastMouseMovedView == this)
|
if (fOwner->fLastMouseMovedView == this)
|
||||||
fOwner->fLastMouseMovedView = NULL;
|
fOwner->fLastMouseMovedView = NULL;
|
||||||
|
|
||||||
// TODO: Use server_token
|
if (fOwner->fLastViewToken == fServerToken)
|
||||||
if (fOwner->fLastViewToken == _get_object_token_(this))
|
|
||||||
fOwner->fLastViewToken = B_NULL_TOKEN;
|
fOwner->fLastViewToken = B_NULL_TOKEN;
|
||||||
|
|
||||||
_SetOwner(NULL);
|
_SetOwner(NULL);
|
||||||
@@ -5343,15 +5340,12 @@ BView::_CheckLock() const
|
|||||||
void
|
void
|
||||||
BView::_SwitchServerCurrentView() const
|
BView::_SwitchServerCurrentView() const
|
||||||
{
|
{
|
||||||
// TODO: Use server_token
|
if (fOwner->fLastViewToken != fServerToken) {
|
||||||
int32 serverToken = _get_object_token_(this);
|
STRACE(("contacting app_server... sending token: %ld\n", fServerToken));
|
||||||
|
|
||||||
if (fOwner->fLastViewToken != serverToken) {
|
|
||||||
STRACE(("contacting app_server... sending token: %ld\n", serverToken));
|
|
||||||
fOwner->fLink->StartMessage(AS_SET_CURRENT_VIEW);
|
fOwner->fLink->StartMessage(AS_SET_CURRENT_VIEW);
|
||||||
fOwner->fLink->Attach<int32>(serverToken);
|
fOwner->fLink->Attach<int32>(fServerToken);
|
||||||
|
|
||||||
fOwner->fLastViewToken = serverToken;
|
fOwner->fLastViewToken = fServerToken;
|
||||||
} else {
|
} else {
|
||||||
STRACE(("quiet2\n"));
|
STRACE(("quiet2\n"));
|
||||||
}
|
}
|
||||||
@@ -5510,7 +5504,7 @@ BView::_PrintToStream()
|
|||||||
fNextSibling ? fNextSibling->Name() : "NULL",
|
fNextSibling ? fNextSibling->Name() : "NULL",
|
||||||
fPreviousSibling ? fPreviousSibling->Name() : "NULL",
|
fPreviousSibling ? fPreviousSibling->Name() : "NULL",
|
||||||
fOwner ? fOwner->Name() : "NULL",
|
fOwner ? fOwner->Name() : "NULL",
|
||||||
_get_object_token_(this),
|
fServerToken,
|
||||||
fFlags,
|
fFlags,
|
||||||
fParentOffset.x, fParentOffset.y,
|
fParentOffset.x, fParentOffset.y,
|
||||||
fBounds.left, fBounds.top, fBounds.right, fBounds.bottom,
|
fBounds.left, fBounds.top, fBounds.right, fBounds.bottom,
|
||||||
|
|||||||
@@ -2905,7 +2905,7 @@ BWindow::_CreateTopView()
|
|||||||
fTopView->fTopLevelView = true;
|
fTopView->fTopLevelView = true;
|
||||||
|
|
||||||
//inhibit check_lock()
|
//inhibit check_lock()
|
||||||
fLastViewToken = _get_object_token_(fTopView);
|
fLastViewToken = fTopView->fServerToken;
|
||||||
|
|
||||||
// set fTopView's owner, add it to window's eligible handler list
|
// set fTopView's owner, add it to window's eligible handler list
|
||||||
// and also set its next handler to be this window.
|
// and also set its next handler to be this window.
|
||||||
@@ -3089,7 +3089,7 @@ BWindow::_UnpackMessage(unpack_cookie& cookie, BMessage** _message,
|
|||||||
cookie.focus_token = _get_object_token_(*_target);
|
cookie.focus_token = _get_object_token_(*_target);
|
||||||
|
|
||||||
if (fLastMouseMovedView != NULL && cookie.message->what == B_MOUSE_MOVED)
|
if (fLastMouseMovedView != NULL && cookie.message->what == B_MOUSE_MOVED)
|
||||||
cookie.last_view_token = _get_object_token_(fLastMouseMovedView);
|
cookie.last_view_token = fLastMouseMovedView->fServerToken;
|
||||||
|
|
||||||
*_usePreferred = false;
|
*_usePreferred = false;
|
||||||
}
|
}
|
||||||
@@ -3553,8 +3553,10 @@ BView *
|
|||||||
BWindow::_FindView(int32 token)
|
BWindow::_FindView(int32 token)
|
||||||
{
|
{
|
||||||
BHandler* handler;
|
BHandler* handler;
|
||||||
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN, (void**)&handler) != B_OK)
|
if (gDefaultTokens.GetToken(token, B_HANDLER_TOKEN,
|
||||||
|
(void**)&handler) != B_OK) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// the view must belong to us in order to be found by this method
|
// the view must belong to us in order to be found by this method
|
||||||
BView* view = dynamic_cast<BView*>(handler);
|
BView* view = dynamic_cast<BView*>(handler);
|
||||||
|
|||||||
Reference in New Issue
Block a user